Warning box/option when running macros, but not default?

  • Thread starter Thread starter FishMan
  • Start date Start date
F

FishMan

Hi
I have a macro which runs a series of action queries (including update,
append and delete) to fill a table from a temporary linked table and
then clear the temp table. I have turned of the action warnings under
access options as there were just to many. However, I would like to put
my own warning to appear at the beginning saying something like
“Warning, you are about to update/delete†do you really want to
do this?â€
and on this warning I would like an OK button and a cancel button.

I can get a message up when it starts using the MsgBox macro action,
but this only has an OK button and no way to stop the macro.

Please help, pretty new to access and have not much VB experience but
could probably manage it with some help ïŠ

Thanks
FishMan
 
I know there is a better way to do this but this is what i know now:

I would have a form with the warning you mentioned then two command buttons
one to run the macro and the second to close the form.
 
In your code put the following lines in:

Dim iAnswer as integer

iAnswer = MsgBox("Are you sure you want to do this?", vbYesNo)
if iAnswer = vbYes then
'Put code you want to run here
end if

Hope it helps.
 
Yes, it helped a lot, new form set up with buttons as suggested, just
what was needed thanks
FishMan
 
Back
Top