Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

default button in msgbox vbYesNo 1

Status
Not open for further replies.

rene1000

IS-IT--Management
Apr 9, 2002
89
NL
How can i set the default button in a message box with a Yes and No button. It always defaults to Yes but i want it to default to No. I used this code:

Dim msg, Style, Title, Response
msg = "Are you sure you want to exit without saving the changes ?"
Style = vbYesNo + vbCritical
Title = "IMIS"


Response = MsgBox(msg, Style, Title)

'exit without saving if the answer is yes
If Response = vbYes Then
'first undo changes and close
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
DoCmd.Close
End If
 
Hi!

Style = vbYesNo + vbCritical + vbDefaultbutton2

HTH Roy-Vidar
 
It's so easy if you know it !

Thanks again Roy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top