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!

vbYESNO

Status
Not open for further replies.

CLOS

MIS
Jan 30, 2002
23
0
0
US
I need some expert Help with this one!

I have a command button that will display a message to the
user prompting them with either a 'YES' or 'NO' question to
confirm a record delete. Now, if a user's response is 'YES',
I want to delete the record. If a user's response is 'No',
I want to cancel the action. Could somebody code this for
me? Thanks!
 
Hopefully this will help a bit. I have left some parts out having to do with the response of the vbquestion because I don't know them on the top of my head, but I am sure someone else here does :) But I think this is almost what you want.

If MsgBox("Your question here in quotes", vbYesNo + vbQuestion, "Name of message box here") = vbYes Then
DoCmd.DoCmd.DoMenuItem acFormBar, acEditMenu, acDelete
Response = ?
Else
Response = code to cancel
Me.[FieldName].SetFocus
End If

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top