Audit Trail - Repost for Clarification Allen Browne

G

Guest

I've implemented the code as described by Allen Brown and everything works great

The problem I have is that I had a macro running in the afterupdate procedures. That got replaced with Allen's code

Is there a way to implement and automatic field change of a date in conjunction with this code

Private Sub Form_AfterUpdate(

Call AuditEditEnd("tbl_ProspectDemographics", "tbl_AudTmpProspectDemographics", "tbl_AudProspectDemographics", "PrspDemoID", Nz(Me!PrspDemoID, 0), bWasNewRecord

End Su

Also does anyone know of a way to flag which fields where actually changed in the audit table

Thanks in advance.
 
A

Allen Browne

If you had code in Form_AfterUpdate to automatically set the date of a field
in your table, you are dirtying the record again as soon as it is saved.
Move that code into Form_BeforeUpdate.

To log which fields actually experienced changes, use Form_BeforeUpdate to
loop through the controls of your form that are bound to fields (not unbound
or bound to expressions), and compare their Value to their OldValue. Handle
Nulls. You may also need to consider whether the form programmatically
alters any fields (i.e. other than directly through the controls.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Joe said:
I've implemented the code as described by Allen Brown and everything works great.

The problem I have is that I had a macro running in the afterupdate
procedures. That got replaced with Allen's code.
Is there a way to implement and automatic field change of a date in conjunction with this code?

Private Sub Form_AfterUpdate()

Call AuditEditEnd("tbl_ProspectDemographics",
"tbl_AudTmpProspectDemographics", "tbl_AudProspectDemographics",
"PrspDemoID", Nz(Me!PrspDemoID, 0), bWasNewRecord)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top