Help with edit log using macro (1 Viewer)

justin0312

New member
Local time
Today, 21:13
Joined
Jul 2, 2021
Messages
22
Hi, I got an edit form where user can edit the saved record. May I know how do I use macro to update the record and save a log of who edit and when the user edit? The user will need to login to edit and I already have set a tempVar to store the username with the login details.

I created a table to store the edit log. tbleditLog with the following fields
ID
Student_ID
EditedBy
DateTimeEdited
 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:13
Joined
Oct 29, 2018
Messages
21,357
Hi. There are a few discussions here on the same topic with sample code and databases. Let me see if I can find a link for you.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 09:13
Joined
May 21, 2018
Messages
8,463
I think the @theDBguy interpreted this to mean you only wanted to do this using Data Macros. This can be done if that is the only way you want to do it, but as you saw that can be complicated. Data macros have the advantage of updating regardless if changes are done on a form or directly in a table. There are a ton of easy examples out there using VBA; however, these are limited to form events and will not update based on changes made directly in tables or queries. Here are some.




These are all pretty easy to implement
1. Build the table.
2. Drop the code into a standard module.
3. Call the module from any form's before update event.
 
Last edited:

Users who are viewing this thread

Top Bottom