Confirm Command

  • Thread starter Thread starter Anthony W
  • Start date Start date
A

Anthony W

I have a form with a command button that opens a form.

Is there anyway that when the command button is clicked,
you are asked to confirm weather you want to open that
form?

Thanks in advance for any assistance


Anthony
 
Hi Anthony
On the onclick event try this code:
If MsgBox("Do you want to open FormName ?", vbOKCancel) =
vbOK Then 'User select OK
DoCmd.OpenForm ("FormName")
else
' do some thing like close this form...
End If
Goodluck.
 
Gurtz said:
Anthony,

If you want to do this, you have to code the opening of
the form yourself, rather than using the wizard. Since you
say you already have the button opening the form, we'll
use the code that Access already set up for you.

In Design Mode, right-click the command button in question
and select "Build Event." You will be taken to the code
that opens your second form. There should be a line in
there that looks like this:

DoCmd.OpenForm stFormName, (etc ..)

Add a line before and after this line, as follows:

If MsgBox("Open form?", vbOKCancel, "MsgBoxTitle") = 1 Then
DoCmd.OpenForm stFormName, (etc ..)
End If

But when they press [OK] How can you be sure that they _really_ mean it? : )
 
Back
Top