DoCmd - Open Parameter Query

ListO

Señor Member
Local time
Today, 04:16
Joined
Feb 2, 2000
Messages
167
I would like to have a DoCmd open a parameter query, but I do not know how to pass a single parameter to the query. Is this possible? If not, how does one automate the use of a parameter query?
 
I don't use the DoCmd statement but here's how I automate my parameter queries:

Dim dbClient As Database
Dim qdf As QueryDef
Set dbClient = CurrentDb
Set qdf = dbClient.QueryDefs("Query1")
qdf.Parameters![Year Month] = rs("YRMTH")
qdf.Execute

where [Year Month] is the paramater in my query and rs("YRMTH") is a variable that I have retreived from a recordset in the module. It could just as well be the name of a control on your form.

denny
 
Thank You!
 

Users who are viewing this thread

Back
Top Bottom