Query at runtime error

G

Guest

Hello, I have a query that is set at runtime but im getting error 91 "Object
variable or With block variable not set".

I have several other reports that use this code but this is the only one
that gives me this error: Here is the SQL.

Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim strCriteria As String
Dim strDocName As String
Dim stWhere As String

strCriteria =[Forms]![Contents]![P]

if strCriteria = "P9" Then
Set qdf = db.QueryDef("CSMPRepair") - THIS IS WHERE I GET THE ERROR (yes I
spell checked it)

Set db = CurrentDb()

Exc....

This code was copied from another one i wrote that works perfect. All i did
was change the db.QueryDef to CSMPRepair and changed the sql statement.
Any Ideas?

Thanks!
 

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