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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use a variable in a query criteria

Status
Not open for further replies.

discodave101

IS-IT--Management
Nov 28, 2001
7
GB
I have the variable 'strTrade' that i need to pass into a query so the graph it produces is correct, how do I put the variable in the criteria part of the query?

 
Set the query up to use a parameter, then use the QueryDef object to set the parameter.

For example, if your query was stored as myQuery, and had a parameter TradeType:

dim qDef as queryDef

set qDef = currentdb.querydefs("myQuery")
qDef.parameters("TradeType") = strTrade
qDef.execute 'or openRecordset

Good luck.

-Ivy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top