how to code yes/no dialog box

H

Haroon

i have a form where i want a dialog box to appear when users click on Submit
button but before the data/info gets populated on the doucment, i want users
to get a yes/no dialog box when they click on Submit button to make sure they
double check info before submitting, if they click yes, the info gets
populated on document, if they click No, the dialog box hides/disappears and
users see the form again to correct the mistakes.

anyone how to do this?
i have managed to make a code for Yes, but can't get the code for No.If
MsgBox("Are you sure?", vbYesNo + vbQuestion) = vbYes Then


cheers.
 
J

Jonathan West

Haroon said:
i have a form where i want a dialog box to appear when users click on
Submit
button but before the data/info gets populated on the doucment, i want
users
to get a yes/no dialog box when they click on Submit button to make sure
they
double check info before submitting, if they click yes, the info gets
populated on document, if they click No, the dialog box hides/disappears
and
users see the form again to correct the mistakes.

anyone how to do this?
i have managed to make a code for Yes, but can't get the code for No.If
MsgBox("Are you sure?", vbYesNo + vbQuestion) = vbYes Then
Try this


If MsgBox("Are you sure?", vbYesNo + vbQuestion) = vbYes Then
'code for Yes goes here
Else
'code for No goes here
End If
 
G

Greg Maxey

Jonathan answered your question. Another method for doing something
like this to to have a blank label on your form. Then code the
command button something like this:


Private Sub CommandButton1_Click()
If Me.CommandButton1.Caption = "Submit" Then
Me.CommandButton1.Caption = "Continue"
Me.Label1.Caption = "Please verify your data entry and press
""Continue"" to complete this form"
Else
Me.Label1.Caption = ""
'Code to process form
Unload Me
End If
End Sub
 

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