qrydef to pass a form control to an existing query

  • Thread starter Thread starter Darrell
  • Start date Start date
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.
 
Have you set the Database Object 'db' previously in your
code?

HTH
Van T. Dinh
MVP (Access)
 
Back
Top