combo box values dependent on user's selection of another combo box

J

jenn

i have a combo box that i need to fill.. the values of
this combo box and redependent of the value selected in
another combo box. This process should be in the
after_update of the first combo box, correct?.. how
exactly would i do this.. this is what i have (and i am
getting a type mismatch error on it, with
the ".recordsource" highlighted):

cmbState.RowSource = CurrentDb.OpenRecordset("SELECT
tblStateTaxDepts.StateAbrv FROM tblStateTaxDepts WHERE
tblStateTaxDepts.TaxType = '" & strTaxType & "';")

Any help would be greatly appreciated. thanks
 
K

Ken Snell [MVP]

Close (expression is all one line, so watch out for wrapping by newsreader):

cmbState.RowSource = "SELECT tblStateTaxDepts.StateAbrv FROM
tblStateTaxDepts WHERE tblStateTaxDepts.TaxType = '" & strTaxType & "';"
 
K

Ken Snell [MVP]

I have modified the code step that you'd posted. Replace your code step with
the one I posted.
 
J

jenn

thank you!.. except if the user goes to change the value
of the tax type again the state combo box list does not
get refreshed with the new values

thanks for your help!
 
K

Ken Snell [MVP]

I am assuming that you're running the code on the "tax type" combo box's
AfterUpdate event, no? So long as you run the code on that event, the code
will change the SQL query string for the "state" combo box.

Perhaps, if you post all the code that you're running for these two combo
boxes, we can help fix this minor issue.
 
G

Guest

Got it.. thanks so much!!
-----Original Message-----
thank you!.. except if the user goes to change the value
of the tax type again the state combo box list does not
get refreshed with the new values

thanks for your help!
selected i
.
 

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