How to create an After Update macro in FE. Tables are linked. BE is different. (1 Viewer)

SachAccess

Active member
Local time
Tomorrow, 02:57
Joined
Nov 22, 2021
Messages
389
Sach,
What is latest status?
My sincere apologies for the delay. I will do it today. Could not log to personal computer yesterday. Was in the office for 14 hours. Forgot to log to personal computer yesterday. Have downloaded both the files now and checking. Will revert with details. Have a nice day ahead. :)
 

SachAccess

Active member
Local time
Tomorrow, 02:57
Joined
Nov 22, 2021
Messages
389
Hi @arnelgp thanks a lot for the help.
My sincere apologies for delay in response. File transfer is an issue at my side.

I checked the files at my end. It is working perfect!
Through Google search, I was under impression that it is not possible in MS Access.

I changed the LTM to path. This is the only change I did at my end.
When I open the FE, it says, Stop All Macros.
But works perfectly thereafter.

I tried to run the macro in F8 mode to study, understand and then edit as per my tables. Pardon my ignorance.
I added a breakpoint at both the 'Public Sub addLog(ByVal userName As String, tableName, ParamArray fields() As Variant)' and
Public Function fncGetUser() and tried doing changes in the tables.

Once I do the change, log table gets updated, but macro is not stopped at any of the breakpoint.
Macro gets executed within a second but did not cannot see any action in the VBA code window.
May be am missing something and do not know how to check these types of modules at break-point (F8).

Public Function fncGetUser() , this module, I did run by doing F8 in the code window. Was able to it.

For Public Sub addLog(ByVal userName As String, tableName, ParamArray fields() As Variant)
I do not know how check it at code line level. Could you please help if possible.

@jdraw could you please check my response above if you get time.

@arnelgp @jdraw have a nice day ahead. :)
 

jdraw

Super Moderator
Staff member
Local time
Today, 17:27
Joined
Jan 23, 2006
Messages
15,379
Sach,
I don't think yo can interrupt/breakpoint a macro.
The point of the afterUpdate data macro on tblSummary is to ensure changes are written to tblLog regardless of from where the changes to tblSummmary arise(query/form/vba/direct table interaction).
F8 and breakpoints work with vba only (as I understand things)
 

SachAccess

Active member
Local time
Tomorrow, 02:57
Joined
Nov 22, 2021
Messages
389
Hi @jdraw thanks a lot for the help.
Please correct me if am wrong.

Audit_FE this file has VBA modules.
Thought I can see and edit the code manually, since it is called by Access Macro, I will not be able to interrupt it.
Even if it a VBA code, can be interrupted when called by Access Macro.

Have a nice day ahead. :)
 

GPGeorge

Grover Park George
Local time
Today, 14:27
Joined
Nov 25, 2004
Messages
1,873
Hi,

I tried searching various website for the solution. I was not able to find it.
Am I correct in thinking that I cannot write After Update macro in BE based on the changes done in FE.

I am trying to create a log for the changes done in tables.
Changes would be done from FE.
Tables are linked from BE.
How do I solve this problem.
Can anyone please help me understand this.
After Update Macros are in the tables in the database where those tables are located. Pat already explained that. Jack explained that.

They run when data is changed in the table to which they are attached, regardless of how that change occurred. Period. Any change to data in a table with an After Update macro on it, when initiated via the Front End does, of course, invoke that macro as soon as the change is saved to the table. That can be done with an update query, with VBA running that modifies the records in that table, or a form bound to that linked table. It can even be invoked by opening the table directly in Datasheet view and manually changing data.

The advantage of that, of course, is that the user simply cannot bypass the data macro. It is integral to that table and does not depend on the method used to modify the data.

I don't see any reason to try to manipulate that from the FE. That's not why we use Data Macros like After Update. They can't call VBA in the Front End.
 

Users who are viewing this thread

Top Bottom