Actions from MsgBox

A

Anna

Hi,

I have a message box that shows when a button is clicked
on a form - how can I perform functions based on what
option is chosen?
For example, if "yes" is clicked, open frmData, if "no" is
clicked, close message box

Here is the code I have for the message box:

Private Sub cmdOpenDataForm_Click()
Dim intAnswer As Integer
intAnswer = MsgBox("Do you want to add new data?"
vbYesNoCancel + vbQuestion, _
"Enquiry")
End Sub

Thanks for any help,

Anna
 
J

James Goodman

If intAnswer = vbYes Then
'Open Yes Form
ElseIf intAnswer = vbNo Then
'Open No Form
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top