Run Macro without Prompting user

  • Thread starter Thread starter TroyDDaniels
  • Start date Start date
T

TroyDDaniels

I'm have a macro that clears out a table and then adds new data. My
question is how can I make it so that it will do it without prompting
the user yes/no to delete the rows or add new rows to the table?
 
Before your action queries add:
SetWarnings (bottom section, Warnings On = No)

You should also turn them back on after (SetWarnings Yes)
 
SusanV said:
...
You should also turn them back on after (SetWarnings Yes)

No harm done, but not really necessary. Warnings are automatically
returned to default at the end of the macro.
 
Didn't know that - thanks! Then again, I don't use macros. I *believe* if
you turn them off using VBA (DoCmd.SetWarnings False) they stay off until
turned back on? Could you verify this?

Either way I feel it's good form to put things back as we found them <g>

SusanV
 
Correct,

Suspending warnings in code keeps them suspended until explicitly turned
back on, as opposed to the suspension through a macro action which only
"lives" for the life of the macro.
The only benefit in resetting warnings at the end of a macro is only so
you don't forget to explicitly reset (in your code) in case you convert
the macro to code.

HTH,
Nikos
 
Back
Top