Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ComboBox Selection as Criteria for another ComboBox....
Message
General information
Forum:
Visual Basic
Category:
VBA
Miscellaneous
Thread ID:
00505347
Message ID:
00505396
Views:
21
>Hi All,
>Please help a newbie!
>What I'm attempting is having a series of ComboBoxes which "drill-down" or "limit" the choices in each as the user moves along to the next ComboBox.
>I works to an extent - when the 1st ComboBox selection is made, the 2nd ComboBox shows the correct limited information.
>When the 2nd ComboBox selection is made, the 3rd ComboBox remains empty.
>TIA!
>~Marla
>
>Form Declarations>>>
>Dim strF1 As String
>Dim strF2 As String
>Dim strF3 As String
>
>ComboBox1
>Row source is>>> SELECT DISTINCTROW TABLE1.FIELDA FROM TABLE1;
>Form Click Event>>>>
>Private Sub Combo1_Click()
> strF1 = Combo1.Text
>End Sub
>
>ComboBox2
>Row source is>>>
>SELECT DISTINCTROW TABLE2.[FIELDB] & " - " & [FIELDC] AS Expr1 FROM TABLE2 WHERE (((TABLE2.FIELDB)=[strF1]));
>Form Click Event>>>>
>Private Sub Combo2_Click()
> strF2 = Combo2.Text
>End Sub
>
>ComboBox3
>Row source is>>>
>SELECT DISTINCTION TABLE3.[FIELDD] & " - " & [FIELDE] & " - " [FIELDF] AS Expr2 FROM TABLE3 WHERE (((TABLE3.FIELDD)=[strF1] AND (TABLE3.FIELDE)=[strF2]));

You need to Refresh the ComboBox. It won't be done automatically. Also, you can't add variable names to the Recordsource property. You will need to rebuild your recordsource property in the click event.
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform