Confirm Command

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
 
M

MN

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.
 
R

Rick Brandt

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? : )
 

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