qrydef to pass a form control to an existing query

D

Darrell

Below is code to pass a control value from a form to an
existing query.

'Specify frmCheckRequest.txtCRID as the parameter for the
'query "rptqryCheckRequest".
Dim qdf As dao.QueryDef
Set qdf = db.QueryDefs("rptqryCheckRequest")
qdf.Parameters("prmCRID") = Forms!frmCheckRequest!txtCRID

Running it generates the error on the "Set..."
line, "Object variable not set". The code has been
written as "dao.QueryDef" and just "QueryDef", with the
same results. What is the problem?

Thanks for your help.
 
V

Van T. Dinh

Have you set the Database Object 'db' previously in your
code?

HTH
Van T. Dinh
MVP (Access)
 

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