Hi All-
We are exploring the use of Data Macros to add audit tracking to our core product. But it has strange effects on performance that make it unreliable solution. Maybe someone can help diagnose the following.
Here is simplest way to repro.
1. Build blank app with a table like "tblEmployee" with a bunch of fields, and one field called "LastUpdated" as Date/Time
2. Add column to table called "ListOrder" which is numeric order.
3. Write VBA script that loops through recordset to table, setting ListOrder to 1, 2, 3 according to Last/First name order.
4. Run script - note that it is very fast, say 5-10 ms for 100 employees.
Now, add a Before Change Data Macro that does SetField LastUpdated to Now(). If you run test VBA script, you'll notice it is still very fast, maybe only a few ms slower.
Then. If you create a new test form, with a ListBox that is bound to tblEmployee, and open the form. Run the VBA script while the form is open, you'll notice again it is still fast.
BUT - If you put a button on the form with a Click event that calls the VBA script above, when you click the button it is 10-20x slower! Uh, what?
This behavior is very mysterious and gives the impression that the simple act of adding a Data Macro to a table, has all sorts of bizarre performance side effects, like suddenly something has to "wait for synchronization" and only if it is an action performed on a bound form. The difference goes away when the Data Macro is removed.
I'm at a loss how to even troubleshoot this further, let alone devise a general solution to our entire application with 250k LOC and 100's of forms. Obviously this one example could be addressed with a workaround, but that is an unexpected problem with unknown effects all over our entire application.
This is a long shot, but any inspiration or insight from the community would be welcome. Specifically with how to build a Data Macro for auditing that doesn't have adverse side effects to a legacy LOB application.
Best Regards
We are exploring the use of Data Macros to add audit tracking to our core product. But it has strange effects on performance that make it unreliable solution. Maybe someone can help diagnose the following.
Here is simplest way to repro.
1. Build blank app with a table like "tblEmployee" with a bunch of fields, and one field called "LastUpdated" as Date/Time
2. Add column to table called "ListOrder" which is numeric order.
3. Write VBA script that loops through recordset to table, setting ListOrder to 1, 2, 3 according to Last/First name order.
4. Run script - note that it is very fast, say 5-10 ms for 100 employees.
Now, add a Before Change Data Macro that does SetField LastUpdated to Now(). If you run test VBA script, you'll notice it is still very fast, maybe only a few ms slower.
Then. If you create a new test form, with a ListBox that is bound to tblEmployee, and open the form. Run the VBA script while the form is open, you'll notice again it is still fast.
BUT - If you put a button on the form with a Click event that calls the VBA script above, when you click the button it is 10-20x slower! Uh, what?
This behavior is very mysterious and gives the impression that the simple act of adding a Data Macro to a table, has all sorts of bizarre performance side effects, like suddenly something has to "wait for synchronization" and only if it is an action performed on a bound form. The difference goes away when the Data Macro is removed.
I'm at a loss how to even troubleshoot this further, let alone devise a general solution to our entire application with 250k LOC and 100's of forms. Obviously this one example could be addressed with a workaround, but that is an unexpected problem with unknown effects all over our entire application.
This is a long shot, but any inspiration or insight from the community would be welcome. Specifically with how to build a Data Macro for auditing that doesn't have adverse side effects to a legacy LOB application.
Best Regards