By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,264 Members | 1,100 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,264 IT Pros & Developers. It's quick & easy.

How do I dynamically create make-table queries

P: n/a
RE: Access 2003

I have linked to a SQL Server database and have the tablenames from
this database in a local lookup table called "tblSQLServerTables".

When looping through this lookup table in a recordset, how do I
dynamically create (via VBA) a make table query for each of the
tablenames in tblSQLServerTables?

When a make table query runs, there's the prompt to "insert x number
of rows into a new table?". Will "Set Warnings = false" eliminate
that message from appearing?

Thanks.

May 8 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Not completely clear on your scenario, but here is the scenario my
example is based on:

You have an mdb file. The mdb has some ODBC linked tables from a sql
server. To create a table on the fly with Access sql you can do
something like this:

Sub CreateNewTableOnTheFly()
DoCmd.RunSql "Select * Into localTbl From ServerTbl Where LastName Like
'P*'"
End Sub

And to remove warning messages you can do this:

Sub CreateNewTableOnTheFly()
DoCmd.SetWarnings False '--turn off warnings here

DoCmd.RunSql "Select * Into localTable From ServerTbl Where LastName
Like 'P*'"

DoCmd.SetWarnings True '--turn warnings back on
End Sub
Rich

*** Sent via Developersdex http://www.developersdex.com ***
May 8 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.