pass parameter for the combo box ?

joyaccess1

Registered User.
Local time
Yesterday, 16:21
Joined
Jan 21, 2008
Messages
32
Hi,

In a form i have combo box for country and state, based on the country that is selected in the country combo box i need the states displayed in the state combo box for the corresponding country selected. how can i do this in the form ?, can i create a dynamic query in the state combo box ? and how to pass the country id to the state combo box ?

any help will be appreciated.

Thanks
Joy
 
You're not giving and Table information as to which table hold what and whatever. Shot in the Dark.........

In the OnClick event of the Country ComboBox (in the Form's code module):

Code:
If Isnull(Me.CountryCombo) = False Then
   Me.StatesCombo.RowSource = "SELECT StatesTable.StateName FROM StatesTable WHERE StatesTable.Country=[B][COLOR="Red"]'[/COLOR][/B]" & Me.CountryCombo & "[COLOR="Red"][B]'[/B][/COLOR] ORDERED BY StatesTable.StateName;"
End If

.
 
thanks cyberlynx, it works like a charm.
 

Users who are viewing this thread

Back
Top Bottom