Combo box based on another combo box

H

hughess7

Hi all

I am trying to code a RowSource for a combo box based on another combo box.
A user chooses a country from CountryCode combo and then I want the list of
Dealers for that country to be displayed in the Dealer combo box. I have a
query which lists all countries and dealers, called [qry dealers] with column
country code, dealer & dealer Name. I have tried to select the correct data
with a where clause. When I choose the dropdown though on the Dealer combo I
am prompted to enter a parameter for A (which is the CountryCode that I want
the list of dealers for).

The code below is attached to the after update event of countrycode:

With Me![Dealer]
If IsNull(Me!CountryCode) Then
.RowSource = ""
Else
.RowSource = "SELECT [Dealer],[Dealer Name] " & _
"FROM [qry Dealers] WHERE [Country Code]=" & "" & Me!CountryCode
& ""
End If
End With

Me![Dealer].Requery

Please can someone tell me where I am going wrong...
Thanks in advance for any help.
Sue
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top