Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / June 2007

Tip: Looking for answers? Try searching our database.

Creating records in one file whilst editing another file

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
88Caddy - 11 Jun 2007 01:37 GMT
I have a simple form which allows updates to records in an employee
file.  Each time a record is changed I would like to create an audit
record in a separate file.  I do not need any input from the user when
creating the record as all the information is implied (date, time,
user, before and after values etc.)  I would be interested to know
what people think the easiest way to do this would be...??  All
opinions welcome - the more the merrier.

Thanks, Jon.
Marshall Barton - 11 Jun 2007 13:12 GMT
>I have a simple form which allows updates to records in an employee
>file.  Each time a record is changed I would like to create an audit
>record in a separate file.  I do not need any input from the user when
>creating the record as all the information is implied (date, time,
>user, before and after values etc.)

You could construct an Append query to put the data into the
audit table (file?), but It might be easier to write the
code to open a recordset and add the record.

If the audit table is in the same mdb file and depending on
the structure of the audit table, the code could be along
these lines:

Set rs = CurrentDb.OpenRecordset("table name")
rs.AddNew
    rs!chgdate = Now
    rs!user = "user name"
    rs!fieldname = "field"
    rs!before = Me.field.OldValue
    rs!after = Me.field
rs.Update
rs.Close : Set rs = Nothing

Signature

Marsh
MVP [MS Access]

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.