Combo to select form then combo to select field for query

B

buscher75

Hello-

My goal is to use a form to prompt a query and open up a report.

What I would like on the form is to have a combo box to select one of three
tables. Then, have a second combo box appear with the fields from the
selected table to choose from.

For simplicity purposes, let's call the forms -
form1 with fields - field11, field12, field13
form2 with fields - field21, field22, field23
form3 with fields - field31, field32, field33

What would be the best approach for accomplishing this?

Thanks in advance for your help!!!
 
J

Jeanette Cunningham

buscher75,
you could use a select case statement for the after update event of the
first combo.

Select case Me.NameOfFirstCombo
Case "table1"
Me.NameOfSecondCombo.RowSource = "qry1"

Case "table2"
Me.NameOfSecondCombo.RowSource = "qry2"

Case "table3"
Me.NameOfSecondCombo.RowSource = "qry3"
End Select

Replace table'n' with your table names.
qry1 is the query with the appropriate fields for when user selects table1,
and so on for the other 2 choices.


Jeanette Cunningham -- Melbourne Victoria Australia
 

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