cascading Combo box issue

rexb

Registered User.
Local time
Today, 12:55
Joined
Oct 29, 2008
Messages
129
Hello,

I've two combo box. Lets call combobox1 and combobox2. when you add and choose data from the combo boxes and will save it and it will display the data but once you add another data it will only display the data on combobox1 and the present data on combobox2 and if you go back to the previous record you will see that combobox1 has data and combobox2 has no data displayed on all previous record. Can somebody tell me what's going on?
 
What you will need to do is force ComboBox2 to requery when you change records. You can achieve this by putting the following in your Form's On Current event;

Code:
Me.ComboBox2.Requery

You should also have this in ComboBox1's On Change event.
 
You should also have this in ComboBox1's On Change event.
Actually, not On Change, but After Update is the right spot. On Change can cause you woes if someone starts to type in the combo.
 
Actually the code is already there and still every time I add a new record it will only save the last record and the previous records will be empty on the combobox2
 
Is combobox2 an UNBOUND combo or is it bound to a field?
 
It is bound to a field. I think what I should say is not displaying the data on combobox2 not that there is no data.
 
Check to see if the "Column Width" property of the combo has the appropriate widths defined so it can be viewed. Like 0";1" to not see the ID field but see the description. But the Column Count property also has to be set to the correct number. If it says 1 then it would need to be 2 if you have two columns in your query.
 
I've checked and it is set at that already. Somethings I've noticed browsing through the records.
1. When you open the database it will set you to the first record say combobox1 = training and combobox2 = MSAccess once you move to the second record combobox1 = facilities location and combobox2 = empty

2. When you add another you choose data for combobox1 = instructor and combobox2 = james that record will be save but when you browse back to the previous record combobox1 will have the right record display and combobox2 would be empty.
 
Sorry, it's frmFacilitiesEntryForm
 
Okay, got it.

Put this in the form's On Current Event:
Code:
Me.cboMaintenanceRequestId.Requery
 
Wow! thanks a bunch. It is working now.
 
Yeah, I have to say that one was not easy to find how to fix. Having the database helped IMMENSELY - so thanks for doing that as it allowed me to look, test, look, test, etc.

Whew! :D
 
I have another access db with the same problem but this one is an inventory sort of thing. I'll try this code first if it doesn't work i'll post the same issue again. Thanks again for the very big help.
 

Users who are viewing this thread

Back
Top Bottom