Full Version: Update Audit On Specific Records In A Subform
UtterAccess Forums > Microsoft® Access > Access Forms
divvyboy
I have a simple form filtered on a specific course code. Within this form, i have a subform that links on the course fields filtered in the main form. This subform contains the students on the filtered course, along with the 2 free text boxes, that the user will fill in. A screenshot of the form is attached for reference. What I would like to do is run an audit update query upon any record that gets changed within this subform. What references do i need to use and on what properties in the subform?
Any questions, let me know.
Many thanks in advance.
jppiii
Without delving too deeply into this, have you thought of using the 'dirty' function to trap an edited record?
Is soon as a record is edited, the record is flagged as 'dirty' - moving to another record or saving the current record manually automatically saves the record and resets the dirty flag to false - if you capture the status of dirty before any of the navigation or form events, this should do the trick.
Sorry - possibly not the clearest response, but when I have two minutes I'll provide some example code.
Thanks, and good luck,
Chris
divvyboy
Hi Chris - thanks for your reply.
Yes, i know about the "On Dirty" property, but's it's getting the update query to reference the fields within the subform - ie the update query must look at the StudentID field within the subform and update my chosen table using the dirty fields as a reference. I can't seem to reference any fields from within the subform
It's been a while since i've done any form work in Access - i've probably have done it before but i've more than likely forgotton how to do it <
jppiii
Ok - here's a simpler way for you - add a new date/time field to the table called last_updated
dd this variable as a hidden field on the sub-form
set the on-change event on the two text boxes to set last_updated=now()
let your query select any records updated within a specific time-frame.
If you need the query to run each time the form is closed then store a system variable called form_time_open and then add the necessary events on the close event to identify anything updated since the form_time_open.
Does that give you what you need?
divvyboy
You sir are a friggin star!
Thanks a lot hat_tip.gif
jppiii
You're most welcome fundrink.gif
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.