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

An easy tabledef/querydef question

Status
Not open for further replies.

jane30

Programmer
Joined
Nov 14, 2000
Messages
92
Location
US
Hi,In my Access97 database, there are 20 tables, c-1-1, c-1-2, c-1-3,etc. I need to create 20 select queries like qryc1,qryc2, qryc3, and so on to join each table with tblMaster. I want to use VBA code---tabledef and querydef to create those select queries like this:


For each tabledef in db.tabledefs
if tdf.name like "c-1*"

sql="select "&tdf.name&".f1,"&tdf.name&".f2 from "&tbl.name&" right join on tblMaster on tblmaster.f1="&tblname&".f1"

set qdf=db.createquerydef("qry"&left(tdf.name,1)&right(tdf.name,1),sql)

What do I do then if I just want to create the query and not run them? Much thanks.



 
There are EASY answers in the Access Help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top