Existing table "Name of table" will be deleted before you run the

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello
Is there any way to disable the message below when running a make table
query or replacing a table.
Existing table "Name of table" will be deleted before you run the query"

Do you want to continue "YES" "NO"

Its an extra click for the user
Thanks
 
Rather than toy with SetWarnings or confirmation options, the best solution
is to use a Delete query followed by an Append query instead of a Make Table
query.

By designing the table ahead of time (rather than using a Make Table query),
you can define the data types you want: which fields are integers, longs,
double, which are text, which are date, and so on. You can also set the
properties (e.g. set Allow Zero Length to No, which is set inconsistently
(depending on your version) by a Make Table query.)

The code to populate the table then looks like this:
Dim db As DAO.Database
Dim strSql AS String
strSql = "DELETE FROM Table1;"
db.Execute strSql, dbFailOnError
strSql = "INSERT INTO Table1 ( ...
db.Execute strSql, dbFailOnError
Set db = Nothing

For further info about the code, see:
Action queries: suppressing dialogs, while knowing results
at:
http://allenbrowne.com/ser-60.html
 
Back
Top