Compile Error: Type Mismatch

W

WildlyHarry

I am trying to use data entered on a form to create an SQL string that will
be passed to a query. Every time I compile the VBA I get the "Compile Error:
Type Mismatch" on the set qdf = query name line. I have checked my reference
library and my DAO 3.6 is the highest priority. Below is my code. Any idea
what the issue might be?

Private Sub Command172_Click()

Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Set db = CurrentDb()
Set qdf = "qry short list status report"

qdf = "SELECT ...
 
C

ChrisO

You seem to like spaces in your names…

Private Sub Command172_Click()

CurrentDb.QueryDefs("qry short list status report").SQL = "SELECT * From
Users"

End Sub
 
W

WildlyHarry

Worked like a charm!

Thanks

ChrisO said:
You seem to like spaces in your names…

Private Sub Command172_Click()

CurrentDb.QueryDefs("qry short list status report").SQL = "SELECT * From
Users"

End Sub
 

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