Select Query Access V.B. Question

R

Rich

Hello all,

This might such a simple question, I am just overlooking the obvious. I
have three select queries defined in an Access DB (i.e. qry1, qry2,
qry3) that each have different sets of orders and fields.

What I am trying to do on a form is use an option group with three
option radials and depending on which one is selected, a combo box
displays the data for that option group selection (using one of the
three queries defined above).

I have it working by using the actual SQL statement in the VB code (i.e.
combobox.rowsource = "SELECT ....", but I would like to just assign
the combobox.rowsource to one of the three named queries. Is there any
way to do this?

It seems obvious, but I don't know how to get to the query SQL info
(i.e. form name use FORMS!xxx) to assign it to a string var.

Thanks in advance,
RJC
 
A

Allen Browne

Did you try assigning the name of the query to the RowSource of the combo?

In the AfterUpdate event procedure of the option group, do something like
this:
Private Sub Frame1_AfterUpdate
Dim strQry As String
Select Case Me.Frame1
Case 1
strQry = "qry1"
Case 2
strQry = "qry2"
Case Else
strQry = "qry3"
End Select
Me.Combo1.RowSource = strQry
End Sub
 

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

Similar Threads

UNION Query with Join 3
Union Query if Yex/No 13
Select Query Question 3
nested queries 1
Nested or Sub query? 2
Query Criteria 4
slow query 1
Survey Queries in Access 5

Top