Automate make-table query

P

Pret

In order to use a table from a network server in one of my applications, I
was forced to construct a make-table query which translates the server
table's field names, and sorts and indexes the records into a more useful
format.

What I'd like to do now is to create a procedure which executes the
make-table query on start-up (new records are added to the server all the
time), and somehow avoids the dialog boxes which warn me that I'm about to
create X number of records and overwrite the existing table (prior update).

Can this be done with code?

Any suggestions appreciated.

Pret
 
D

Douglas J. Steele

While it's generally not considered a good idea to use make-table queries in
an application, the alternative (predefining the table, and having the data
append to that table) can have the same pop-ups, so it's kind of a moot
point...

If you're using RunSQL, put

DoCmd.SetWarnings False

before the RunSQL command, and

DoCmd.SetWarnings True

afterwards.

However, it's probably better to use the Execute method of the Database
object:

CurrentDb().Execute strSQL, dbFailOnError

The Execute method doesn't display pop-ups, and the dbFailOnError parameter
will cause a trappable error to be raised if something goes wrong with the
process.
 
Top