Forum Discussion
guitar713
Mar 04, 2024Brass Contributor
Combo Boxes not displaying Data
I have 2 forms. The first form has drop down boxes and they work well.. I have a button in call and open the second form. The second form opens and the first form remains open, which is what I w...
guitar713
Brass Contributor
So the way I am calling the second form is to double click on a text box. I use the following code:
----------------------------
Private Sub txtCURRENTPeoplesoft_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
frmPeopleSoft.Show vbModeless
frmPeopleSoft.Enabled = True
End Sub
----------------------------------
But when I put the code that you recommended into the form 2 as follows:
----------------------------------
Private Sub UserForm_Initialize()
frmPeopleSoft.Enabled = True
Me.ComboBox1.RowSource = "Table3"
End Sub
-----------------------------
then I run my code, I get the following error
Run-time error '380':
Could not set the RowSource property. Invalid property value.
Then when I click on the debug tool, it goes to
Private Sub txtCURRENTPeoplesoft_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
frmPeopleSoft.Show vbModeless ---- this one is hightlighted as errored???
If you can follow my logic, this is what is happening.
thanks.
----------------------------
Private Sub txtCURRENTPeoplesoft_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
frmPeopleSoft.Show vbModeless
frmPeopleSoft.Enabled = True
End Sub
----------------------------------
But when I put the code that you recommended into the form 2 as follows:
----------------------------------
Private Sub UserForm_Initialize()
frmPeopleSoft.Enabled = True
Me.ComboBox1.RowSource = "Table3"
End Sub
-----------------------------
then I run my code, I get the following error
Run-time error '380':
Could not set the RowSource property. Invalid property value.
Then when I click on the debug tool, it goes to
Private Sub txtCURRENTPeoplesoft_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
frmPeopleSoft.Show vbModeless ---- this one is hightlighted as errored???
If you can follow my logic, this is what is happening.
thanks.
djclements
Mar 05, 2024Bronze Contributor
guitar713 The error message you're getting is a pretty good indication that "Table3" does not exist as a defined name in the workbook. To verify the name of the table you want to use as the RowSource, select any cell within the table, then go to the Table Design tab on the ribbon. Copy the Table Name and paste it into your code to ensure that it's spelled correctly.
- guitar713Mar 05, 2024Brass ContributorI just confirmed it,, I do have the correct table called out,,, so I was curious,, I tried to paste another group of cells I know works from Form 1 into the "RowSource" area,, and that one also did not work. I know it works in Form1 but not Form2, still no data is showing up.
- djclementsMar 05, 2024Bronze Contributor
guitar713 Just as one last troubleshooting step, are you able to open the second userform on its own? From the Visual Basic editor, if you double click on the userform name in the project pane to view it, then press F5 on your keyboard, does it open up with the combobox populated? At this point, without working on your file directly, I'm out of ideas.
- guitar713Mar 05, 2024Brass ContributorYES, THAT WORKS.....