Are You Sure? ... design question

  • Thread starter Thread starter tom_f
  • Start date Start date
T

tom_f

Guest
I have several forms (menus), each with numerous buttons that launch macros to perform various lengthy procedures, for example large file loads. I am concerned about accidental clicks.

I think I should have a way to react to a click with (1) some variable text, like, "Pushing this button will reverse the earth's magnetic poles. Are you sure you want to proceed?" (2) a pair of buttons labelled Continue and Cancel (3) a pair of supplied macro names for responding to the continue/cancel buttons. Of this wish list, the supplied text part is a nicety and is not critical.

Since I have lots of macro-launched procedures, I'm hoping that there is some slick way (one size fits all) to implement an Are You Sure function without grinding out custom code for each button.

If this is an already solved problem, please advise. Otherwise, suggestions please?

Thank you.
 
behind the button put this code

Private Sub yourCommandButton_Click()
Dim answer As String

answer = MsgBox("do you really want to run this?", vbYesNo, "Confirm")
If answer = vbYes Then
DoCmd.RunMacro ("yourMacroName")
End If
End Sub
 
thanks! this worked just fine
 

Users who are viewing this thread

Back
Top Bottom