Refreshing rowsource query for combobox?

Thom

New member
Local time
Today, 18:26
Joined
May 9, 2005
Messages
8
Hi all,
I have a combo box which gets it's values from a table. It also has a where statement to filter the data given the value in another combo box. I.e.
SELECT DISTINCT Table1.some_field FROM Table1 WHERE Table1.some_other_field = Forms!frmSomeForm.Combo_box
The first time I change the value in Combo_box combo box it will filter the values in my other combo box. But when I change it successive times it doesn't refresh the query, so the same values stay. Any suggestions?
 
This is a cascading combo box. When you change the value in the first combo you need to requery the second combo. Use the after update event of the first combo do do this
 
Thanks, but how do I requery a query without a name? Since it's just in the rowsource field...
 
Thanks, but how do I requery a query without a name? Since it's just in the rowsource field
- You requery the combo, not the RowSource.

Me.YourCombo.Requery
 
Thanks Pat. That is what I meant. Me.cboWhatever.Requery But I would also change the source of the cbo to a stored query rather than sql.
 
Last edited:
I would change the reference to a query as suggested. You can force a data refresh by writing in the after update event the following code. If the requery does not do it, the code below should.

docmd.RunCommand.accmdRefresh
 
Ya, thanks guys. Lots of helpful people here :) I actually figured it out about 10 seconds after I posted, unfortunately I don't have internet access on my comp at work... I just refreshed the combo box.
 
Cascade Combo boxes

Tom,
Can you please help me I want to create Cascade Combo boxes
CD Group
CD Name
Only display the CD's related to CD Name related to CD Group NOT ALL THE CD NAMES.

I can send you attatchment files so you know what I am referring to if you give me your email adderess to use for this purpose only.

Thanks,

Mike Van der STad
 

Users who are viewing this thread

Back
Top Bottom