Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

QueryDefs in MS Access

Status
Not open for further replies.

BuckHunter1

Programmer
Feb 25, 2003
4
US
Is it possible to create a temporary querydef from records in another temporary querydef (ODBC connection)?

For Example:

Set qdf = Workspace.CreateQueryDef("qryTemp", "SELECT * FROM SomeTable")

Set qdf1 = Workspace.CreateQueryDef("qryTemp1", "SELECT * Fiel1, Field2 FROM qryTemp")


PLEASE HELP!!!
 
Have you actually tried the code? Just by trying you might get your answer.
 
I tried the above code but it did not work. It returned an error "ODBC--call failed."
 
Yes it is possible using something like that code up top, but what you had in the code up top isn't creating a temporary querydef, it is creating a permanent querydef.

To create a temporary one I think you have to send an emptystring in the name parameter. Anyway, I believe if you create a querydef object, then set it

myQDF = CreateQueryDef("",sqlString)

you can open this recordset using .openRecordset and do stuff with it.

You can also do something like what you did up top but unless your queries always have the exact same fields(Or you use all fields from first query) it becomes a little complicated.
 
Thanks, DoDo1975. A point of note, the querydef I created was in fact a temporary querydef since I was querying an ODBC data source. Anyway, thanks for the input. If anyone else knows of a novel method to accomplish this, please let me know as it would make my life much easier.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top