parameterize select statement

G

Guest

Hi
there are two combs in a form. They are all based on select statements to
fill data.
one selection of a comb should decide the other's select statement's where
clause.
How can I do it

Clara
 
M

Marshall Barton

clara said:
there are two combs in a form. They are all based on select statements to
fill data.
one selection of a comb should decide the other's select statement's where
clause.


Use the first combo box as criteria in the second combo
box's row source query. e.g.

SELECT f1,f2
FROM table2
WHERE f3=Forms!theform.combo2

Then in combo1's AfterUpdate event procedure:
Me.combo2 = Null
Me.combo2.Requery

You will probably also want the Requery line in the form's
Current event.
 
G

Guest

What there is an "All" option item in the first comb list.That will mean the
where clause will be erased away

clara
 
M

Marshall Barton

clara said:
What there is an "All" option item in the first comb list.That will mean the
where clause will be erased away


You could reconstruct the second combo box's RowSource SQL
statement, but it might be easier to change the query's
criteria for field f3 to:

Forms!theform.combo2 OR Forms!theform.combo2 = "ALL"
 

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