Create Query in VB

agehoops

Registered User.
Local time
Today, 23:49
Joined
Feb 11, 2006
Messages
351
I've generated the SQL string needed for the query, but how do I go about actually creating the new query? I've found various things on the net, namely the CreateQueryDef (I think) but couldn't get it to work. does anyone have the exact code or resource I need?

Thanks
 
I've generated the SQL string needed for the query, but how do I go about actually creating the new query? I've found various things on the net, namely the CreateQueryDef (I think) but couldn't get it to work. does anyone have the exact code or resource I need?

Thanks

Code:
Call CurrentDb.CreateQueryDef("QueryNameHere", "SQL STRING HERE")
 
Hey, thanks. it seems to work but I don't see the Query in the Queries list or doesn't this create it there? If not then that's fine, but How do I get it to actually run the query as it isn't doing that? Thanks
 
Hey, thanks. it seems to work but I don't see the Query in the Queries list or doesn't this create it there? If not then that's fine, but How do I get it to actually run the query as it isn't doing that? Thanks

It does create it in the queries list, if you had the query list selected while you ran this code press <F5> to refresh the screen, it should show up.
 
Yea just figured that one out now, thanks. Works a treat :)
 

Users who are viewing this thread

Back
Top Bottom