J
John Ortt
I have a macro which deletes all the data in the database when an
Administrator desires to do so.
It would not be a disaster if it was run by accident but I would like a
"second chance button" incase the user presses it by accident.
I want to use a message box with the message "Are you sure you want to do
this?" and a Yes/No option result.
If the result is a Yes then it goes ahead otherwise it aborts.
My code to do this was as follows but it does not seem to work:
Function SecondChanceCode()
MsgBox "Are you Sure?", vbYesNo
If VbMsgBoxResult("Yes") Then
MsgBox "Good"
'Code to run delete macro to be inserted here and comment removed
Else: MsgBox "Too Bad"
'Comment to be removed
End If
End Function
Any advice would be greatly appreciated.
Thanks,
John
Administrator desires to do so.
It would not be a disaster if it was run by accident but I would like a
"second chance button" incase the user presses it by accident.
I want to use a message box with the message "Are you sure you want to do
this?" and a Yes/No option result.
If the result is a Yes then it goes ahead otherwise it aborts.
My code to do this was as follows but it does not seem to work:
Function SecondChanceCode()
MsgBox "Are you Sure?", vbYesNo
If VbMsgBoxResult("Yes") Then
MsgBox "Good"
'Code to run delete macro to be inserted here and comment removed
Else: MsgBox "Too Bad"
'Comment to be removed
End If
End Function
Any advice would be greatly appreciated.
Thanks,
John