Link to home
Start Free TrialLog in
Avatar of darrellread
darrellreadFlag for United Kingdom of Great Britain and Northern Ireland

asked on

ms access

how do you get a message box on the stop button to ask you if you want to quit, and then not quit if you click on no?
ASKER CERTIFIED SOLUTION
Avatar of jbrugman
jbrugman

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of darrellread

ASKER

i hope it works
Avatar of jbrugman
jbrugman

if you don't get it to work, tell, so i can help implementate.
I have added this code to the button, but it comes up with a help button on the message box, i have no help file, and don't plan to have one so i do not need this in the text box. Below is a copy of the code i have used...

Private Sub Command51_Click()
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "Are you sure you want to quit?"    
Style = vbYesNo  ' Define buttons.
Title = "SEAS Database"   ' Define title.
Ctxt = 1000
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then DoCmd.Quit
End Sub

I would also like to know what the Ctxt does.
Msgbox consists of the following components:

MsgBox prompt,vbYesNo,title,helpfile,context

context = optional, a numeric expression for the help context number.
When not using a help file, don't use context as well.

Greets,
Justus
cheers this works
ok :)