Verification request on exit

Johnhook

New member
Local time
Today, 00:41
Joined
Sep 27, 2002
Messages
8
hello every1

Would it be possible for upon the clicking of an exit button of a form (using the exit macro in access) to bring up a box saying "are u sure u want to exit etc....." and then give options yes or no.

Thanks for ur help

Jon
 
I typucally stay away from macro.
Use the following code in the On Click event of your button

Command10 is the name of the command button, so you'll have to put yours there

Private Sub Command10_Click()
On Error GoTo Err_Command10_Click

If MsgBox("Exit program now?", vbYesNo + vbQuestion, "Exit program?") = vbNo Then
Else
DoCmd.Quit
End If

Exit_Command10_Click:
Exit Sub

Err_Command10_Click:
MsgBox Err.Description
Resume Exit_Command10_Click

End Sub

Hope this helps
 
Thanks loads now my teachers think im a "VB Pro" and are off my back for a while!!!!

Jon
 

Users who are viewing this thread

Back
Top Bottom