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

Help with command button

Status
Not open for further replies.

johngordon

Technical User
Jun 29, 2002
112
US
I have a command button on a form that when clicked duplicates specific data into a new record.

I would like to have a message box pop up and ask the user if they want to continue, giving the user a choice of OK or Cancel.

Can anyone help me and give me some guidance with making this happen?

Thanks,

John
 
Something like this should work:

cmdEnterRecord_Click()

If msgbox("Are you sure you want to enter this record?",36,"System message")=vbNo then
exit sub
Else
yourproceduretoentertherecord
End if
End sub

The pop up message box will have choices of Yes or No. Whatever they click will determine which path they take in my If stmt, above.

Hope this helps.
 
Try this

If MsgBox("What's My Button", vbOKCancel, "Button In") = vbOK Then
MsgBox "You pressed OK", vbOKOnly, "OK"
Else
MsgBox "You pressed Cancel", vbOKOnly, "Cancel"
End If

David Pimental
(US, Oh)
dpimental@checkfree.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top