How to skip the "confirm-question" when running an remove-query

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

Guest

I have a query which removes a lot of records in a table.
Every time I run it I have to confirm it two times. First time Access will
ask if if I'm sure the run the query which will remove data, and second time
if I want to remove x number of records.

I am running several queries like this one in 1 Macro. So when I run this
macro, I have to confirm about 10 times.

Is there a way to get around this problem?
 
Turning SetWarnings off might help, but you would not know if things are
working or not.

If you use code instead of a macro, you an Execute the query and only get a
warning/error message if something goes wrong. This kind of thing:

Public Function DoMyStuff()
Dim db As DAO.Database
Dim strSql as String

Set db = dbEngine(0)(0)

strSQL = "DELETE FROM Table1;"
db.Execute strSql, dbFailOnError

strSQL = "DELETE FROM Table2;"
db.Execute strSql, dbFailOnError

'etc.
End Function
 
Anders

Check into the use of the SetWarnings command. If you are working within a
Macro, you can turn the warnings off before running the queries.

WARNING! If you don't turn the warnings back ON after you are done, you
won't know if Access is having problems.
 
Same problem.

I have a report that uses an Action query (maketable) and even tho I have
confirmations turned off in the database options, I still get the
confirmation msg that the table will be deleted.

How do I stop that?
The query is the Source of the report and no code is used, except the code
to run the report itself. I'll try setwarnings in the report open code if I
can.

MichaelM
 
Reply to meself:
I was able to use DoCmd.SetWarnings in the code that started off the
Maketable query.

MichaelM
 
Back
Top