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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make NO of "Yes" , "No" buttons the default

Status
Not open for further replies.

herrld

Technical User
May 10, 2001
69
0
0
US
I have the following code on a form. It works fine, however, I would like to force the NO button to be the default when this message box comes up. Also, somehow show that NO is pre-selected for them by changing the appearance of the NO box.

Private Sub DeleteBtn_Click()
On Error GoTo Err_DeleteBtn_Click

Dim strMsg As String
strMsg = "Do you wish to delete this vendor and all related information?"
strMsg = strMsg & " Click Yes to Continue with Deletion. Click No to Cancel."
If MsgBox(strMsg, vbQuestion + vbYesNo, "WARNING! DELETE VENDOR?") = vbYes Then

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

Else
DoCmd.CancelEvent
Me![VENDOR].SetFocus

End If

Exit_DeleteBtn_Click:
Exit Sub

Err_DeleteBtn_Click:
MsgBox Err.Description
Resume Exit_DeleteBtn_Click

End Sub

Thanks!

Linda
 
Linda

One tiny modification:

If MsgBox(strMsg, vbQuestion + vbYesNo + vbDefaultButton2, "WARNING! DELETE VENDOR?") = vbYes Then

John
 
John,
Thanks SO much for your help!

Linda
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top