Full Version: Run a Macro on change of Record on a Form
UtterAccess Forums > Microsoft® Access > Access Forms
Rahulkumar
Hi!
Is it possible to run a Macro each time the user changes the Record on the Form? If so how?
Steve Schapel
Rahulkumar,
es. This would probably be done by assigning the macro on the After Update event of the Form. Though it could also be that the Before Update event may be more applicable, depending on your required functionality.
freakazeud
Hi,
how do you determine a change in a record? Does a value of any field actually need to change or does the user just need to touch the record? Is this a bound or unbound form? In a bound form scenario you could probably work with the dirty property/event in combination with the OldValue property of controls. Compare them to the current value and based on that run your code. The evaluation could happen on the before update event of the form. What kind of macro are you trying to execute? Since you will need to use VBA for the evaluation why not stick with it and convert the macro to VBA. If you still want to run the macro then use the RunMacro method.
HTH
Good luck
Rahulkumar
Hi freakazeud !
It's a bound Form and the user needs to click the Next Command Button to go to next Record. What is the Event which is assosiated with this/
Rahul
freakazeud
Well you could actually utilize the click event of the command button itself or use the form's before update event.
HTH
Good luck
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.