Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you select which query?

Status
Not open for further replies.

vince99

IS-IT--Management
Mar 1, 2001
63
US
How can you select which query you want to run by using a drop down box?

Thanks In Advanced
 
Hello,

Modify the following sample code:

Sub QueryDefSample()
Dim q As QueryDef
For Each q In CurrentDb.QueryDefs
MsgBox q.Name
Next

Set q = CurrentDb.QueryDefs("x")
DoCmd.RunSQL (q.SQL)
End Sub

Use the For Each loop to obtain a list of available queries and place them into the Combobox field list. Then, when the user selects a query from the list, use the second part of the code to run the query that corresponds to their selection. Rob Marriott
rob@career-connections.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top