Closing Form control vs Button control for Exiting

G

Guest

I have two problems.

First, I want to put a vbYesNoCancel box up when folks try exiting (save
changes, abandon changes or return to form). The problem is when I put the
code in at the Form BeforeUpdate level, the Form BeforeUpdate has priority
over the other field controls which have BeforeUpdate logic. (i.e. when I
try executing my "Save" button which has BeforeUpdate logic, the logic is
never reached because the Form BeforeUpdate is executed first) What is the
best method for accomplishing priority on this -- I want the "X" close to run
only when someone tries closing the form/window/popup?

The second problem has to do with the logic on the "Save" option. Below is
my logic, but I get an error from the system when I execute the logic:

If iQuit = vbYes Then
DoCmd.RunCommand acCmdSaveRecord
DoCmd.Close
End If

Error:
Run-time error '2115'
The macro of function set to the BeforeUpdate or ValidationRule property for
this field ispreventing Microsoft Office from saving data in the field.

I'm new at all of this so please bear with any ignorance I may have.

Cheers,
Leslie
 
B

Bill

For the second problem - DoCmd.RunCommand acCmdSaveRecord use Dirty = False
instead.
THT
Bill
 
G

Guest

Thanks Bill!

Do I put the "Dirty = False" before or after the "DoCmd.RunCommand
acCmdSaveRecord " command?

In my first part of the question, even if I can do some kind of check on
using the Windows 'X" (upper RH corner) to isolate that functionality would
be great.

Thanks again Bill for your help!

Cheers,
Leslie
 
B

Bill

Instead of.
HTH
Leslie said:
Thanks Bill!

Do I put the "Dirty = False" before or after the "DoCmd.RunCommand
acCmdSaveRecord " command?

In my first part of the question, even if I can do some kind of check on
using the Windows 'X" (upper RH corner) to isolate that functionality would
be great.

Thanks again Bill for your help!

Cheers,
Leslie
 

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