PC Review


Reply
Thread Tools Rate Thread

Compile Error: Type Mismatch

 
 
WildlyHarry
Guest
Posts: n/a
 
      21st Apr 2010
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 ...

 
Reply With Quote
 
 
 
 
ChrisO
Guest
Posts: n/a
 
      21st Apr 2010
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


--
A nod is as good as a wink to a blind horse.


"WildlyHarry" wrote:

> 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 ...
>

 
Reply With Quote
 
WildlyHarry
Guest
Posts: n/a
 
      21st Apr 2010
Worked like a charm!

Thanks

"ChrisO" wrote:

> 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
>
>
> --
> A nod is as good as a wink to a blind horse.
>
>
> "WildlyHarry" wrote:
>
> > 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 ...
> >

 
Reply With Quote
 
ChrisO
Guest
Posts: n/a
 
      21st Apr 2010
No problem but I think life would be easier with qryShortListStatusReport…
--
A nod is as good as a wink to a blind horse.


"WildlyHarry" wrote:

> Worked like a charm!
>
> Thanks
>
> "ChrisO" wrote:
>
> > 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
> >
> >
> > --
> > A nod is as good as a wink to a blind horse.
> >
> >
> > "WildlyHarry" wrote:
> >
> > > 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 ...
> > >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile Error : Type Mismatch WildlyHarry Microsoft Access 2 22nd Apr 2010 02:19 AM
Compile Error: Type Mismatch WildlyHarry Microsoft Access 0 21st Apr 2010 06:31 PM
Compile Error: Type Mismatch WildlyHarry Microsoft Access 0 21st Apr 2010 06:25 PM
Help: Compile error: type mismatch: array or user defined type expected lvcha.gouqizi Microsoft Excel Programming 1 31st Oct 2005 08:20 PM
Compile error: type mismatch pjhageman Microsoft Excel Programming 2 10th Jan 2004 08:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:12 PM.