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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to create queries to be used in a Union without saving the querie

Status
Not open for further replies.

jsogchr

Technical User
Mar 27, 2003
4
CA
I have 3 imported tables. I am trying to write a VB program in Access that will create a query (or table or recordset) from each table then union the queries. I have several criteria I want included in the WHERE statements that can be omitted or defined by the user. All three queries use the same criteria. I do not want the queries to save because they are not going to be used again and Access will not write over a query if you name it the same in a program. I had to name the queries like this: "qryPt1" & int(timer), so after running to program a few times you end up with several useless saved queries.

I have tried using recordsets, but they can not be used in the union query (the SQL statement is referenced not the name of the recordset and the SQL statements behind the recordsets are too long and get cut off).

I have tried using a parameter query, but the user must enter a valid parameter for each criteria for all three queries (can't leave any blanks).

I have also looked into using an append query.

Any suggestions are welcome.

Thank you,

Susan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top