Run a Macro on change of Record on a Form

rahulndeepti

New member
Local time
Today, 21:17
Joined
Feb 23, 2008
Messages
3
Hi!
Is it possible to run a Macro each time the user changes the Record on the Form? If so how? :confused:
 
It should be pretty simple really:
Code:
Private sub MyForm_Current()

  docmd.runMacro [I]your syntax here[/I]

end sub
 
Hello Friends
During data entry I am running a Macro to update some fields in an other table. When I click the Command Button, Macro runs and my tables are update. Every thing is fine.

But I want that when User finish Data Entry, required fields must Auto Update.

For this, I tried to run this Macro Form's On_Current Event, Form's After_Update Event.... but Data does not update.

Where to run this Macro.... ?
thanks
irsmalik
 
What determines that the user has finished data entry ?
And how do you guarantee that you capture that ?

Normally you would run validation code in the forms BeforeUpdate event, as it allows you to cancel the saving of the record if things aren't correct.
 
With the kind of things you are doing, you need to determine a proper time to do it, which means careful selection of which event you use to "drive" the process.

Therefore, Minty's questions about data entry are extremely important!

For future reference, you could have started a new thread rather than tacking on to an old, closed thread. But that isn't a slam. It is more of a suggestion so you get all the attention you need for this question.

Another question comes to mind. You suggest that your user is updating data on a form. How many fields will the user be updating? (Then Minty's two questions become relevant.)

Next question: What does the macro do (i.e. which actions do you use?) Because if as you say, it doesn't update these other tables, your problem could be EITHER that you have picked the wrong event to trigger the update. OR it could be that the macro is running but is faulty and thus does not update anything.
 

Users who are viewing this thread

Back
Top Bottom