Combobox - change in selection and On Change event

G

Guest

I am using the result of a combobox selection (Combo1) as a foreign key value for a subsequent combobox (Combo2) query.
The first time a value is selected in Combo1, all is OK. The Combo2 query correctly picks up the foreign key value in the Combo1 field (Criteria in my query is set to [Forms!][FormName]![Combo1] and filters the query result list appropriately. If I go back and change the selection in Combo1 after I have done this, the value in the field is not updated with the new selection - the Combo2 query uses the original selected value. Can I use code in the On Change or After Update event for this control (Combo1) to "force" the update of the field value based on the new selection? If this is do I refer to the selected value in the query using code?
 
D

Dan Artuso

Hi,
The usual way to do this is to requery Combo2
in Combo1's AfterUpdate event.

--
HTH
Dan Artuso, Access MVP


Linda said:
I am using the result of a combobox selection (Combo1) as a foreign key value for a subsequent combobox (Combo2) query.
The first time a value is selected in Combo1, all is OK. The Combo2 query correctly picks up the foreign key value in the Combo1
field (Criteria in my query is set to [Forms!][FormName]![Combo1] and filters the query result list appropriately. If I go back and
change the selection in Combo1 after I have done this, the value in the field is not updated with the new selection - the Combo2
query uses the original selected value. Can I use code in the On Change or After Update event for this control (Combo1) to "force"
the update of the field value based on the new selection? If this is do I refer to the selected value in the query using code?
 

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