How can I get BeforeUpdate macro on form to run in Office07?

  • Thread starter Thread starter Pearl
  • Start date Start date
P

Pearl

I had a macro set to run Before Update on a form that worked just fine in
Office 03. Now that we've gone to Office 07 it won't let users off the form
even if the conditions are true. In fact, they can't go off the form when
they make a change to any field, even if it has nothing to do with the
conditions set in the macro. Any suggestions?
 
Did you look at the macrosettings for your db? Look under the Microsoft
Office button -> Access options -> Trustcenter -> trustcenter settings (on
the right of the dialog). Maybe the macro's aren't enabled for this project.

hth
 
I'd tried that too, but not working. (Other macros were working, but I tried
it anyway.) The Before Update macro evaluates a formula that, if option 1 is
true should StopMacro and move on. If option 2 is true, then there is a
MsgBox with CancelEvent until user corrects the data entry error. The option
2 part works and doesn't let users off the form. The problem is that any
data change to the form prevents users from advancing to the next record,
even if it has nothing to do with the field being evaluated. I've tried
adding the formula being evaluated to the control directly on the form, as
well as in the query the form runs from. I don't think the formula is the
problem, it seems to have something to do with the StopMacro piece, which
isn't working. Even tried StopAllMacros and that didn't work either. This
prevented data entry errors by not letting users enter the same data in 2
exception code fields, so I'd really like to get this working again. Help!
 
Hmm, i'm not using macro's very much. Are you talking about an embedded macro
or a macro you created yourself. In the latter post the steps the macro is
taking and i'll try to simulate it in my machine. Meanwhile why not consider
converting this macro to VBA (or aren't you ready for that yet?).
 
Well, I only know very little about VBA, just enough to really screw
something up I'd imagine.

The macro does the following:
If evaluated condition result of field = "OK", then StopMacro
If evaluated condition redult of field = "NOT", then MsgBox/CancelEvent.

It is set to run on the form property sheet, Event tab, Before Update. What
it did before was just not allow users to select the same exception code
twice. It wouldn't let them off the record until they had corrected this. I
had to take it off because it isn't working in Office07 (it worked just fine
in Office03), which leaves the door open for data entry errors.

I've worked in the VB editor, so could add something there is that would work?
 
Ok, let's see if I got this right.

I created a macro with two conditions the first one testing to see if a
certain date lies before the current date. In that case I've chose the action
"StopMacro". The second condition evaluates if the certain date is greater
than the current date. In that case I've chose the action msgbox "test". The
only thing i didn't have was the two arguments combined msgbox/CancelEvent.
The first part works so if that's the case try removing the CancelEvent or
add an additional line based on the result.
 
Hello!
Tried removing the CancelEvent, but then it still isn't working the right
way. What I've ended up doing is taking the macro off the Before Update
property on the form, and adding it to each exception line on the OnExit
property. Seems like I shouldn't have to do it this way, but at least it
works.

Thanks for your suggestions!
 
Back
Top