Run Macro without Prompting user

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?
 
S

SusanV

Before your action queries add:
SetWarnings (bottom section, Warnings On = No)

You should also turn them back on after (SetWarnings Yes)
 
S

Steve Schapel

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.
 
S

SusanV

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
 
N

Nikos Yannacopoulos

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top