build dynamic query

G

Guest

Hi there,

I think i am going around in circles here!

I have a form where a user can build a query and set criteria based on a
series of combo boxes. I have it set up such that comb2 values are limited
to what is entered in combo1.

Problem:

What if the user only wants to select a value in Combo2? How can I
dynamically chagne the rowsource to NOT be dependant on combo1 if there is no
value selected in combo1.

Thanks in advance
 
D

Douglas J. Steele

How are you basing comb2 on comb1? The usual way is to put code in the
AfterUpdate event of comb1 to change the Row Source of comb2. If that's how
you're doing it, simply set the Row Source to not be based on comb1.
 
G

Guest

Hi, Carlee.

In form design view, set the RowSource of the 2nd combo box to what you want
it to be if there is no value in Combo1. Then in the AfterUpdate event of
combo1, set it to the filtered value, or the original value if it is null:

' AfterUpdate Event of Combo1
If IsNull([Combo1]) Then
' Set to original SQL here
Else
' Set to filtered SQL here
End If

HTH
Sprinks
 

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