Query wont work unless I copy and past into new one

mmitchell

Registered User.
Local time
Today, 04:54
Joined
Jan 7, 2003
Messages
80
I am createing a query in VBA, saving it, then running it, and it does not work.

But if I go into SQL mode, copy and past it into a new query it runs. I have comparied the one that does not work and the one that does and they are identical.

What's up?!!

Here is my code to create it:

Dim dbsNorthwind As Database
Dim qdfNew As QueryDef
Dim qdfLoop As QueryDef
Dim prpLoop As Property

Set dbsNorthwind = CurrentDb 'OpenDatabase

' Create new QueryDef object. Because it has a name, it is automatically appended to the QueryDefs collection.
Debug.Print strSQL_String
Set qdfNew = dbsNorthwind.CreateQueryDef("YourQueryResults", strSQL_String)
 
Your strSQL_String is empty..enter some select, insert,update or delete statement..then try it.. it should work
 
Your strSQL_String is empty..enter some select, insert,update or delete statement..then try it.. it should work
 

Users who are viewing this thread

Back
Top Bottom