473,322 Members | 1,347 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Track changes to a record in Access

14
Hi,

I'm creating a database and I need to find a way to track the changes to a record, more exactly, I need to know who makes changes to each record, as the users can only modify their own records.

I have one table where all the data is stored and I have between 50-100 users. Due to the high number of users, I would like to use the Windows login user ID instead of having to create user ID in Access. Is it possible? If yes, what is the code to be able to get the information (who changed the record) added to my table?

Thank you!

Marie
Nov 8 '07 #1
2 9266
ADezii
8,834 Expert 8TB
Hi,

I'm creating a database and I need to find a way to track the changes to a record, more exactly, I need to know who makes changes to each record, as the users can only modify their own records.

I have one table where all the data is stored and I have between 50-100 users. Due to the high number of users, I would like to use the Windows login user ID instead of having to create user ID in Access. Is it possible? If yes, what is the code to be able to get the information (who changed the record) added to my table?

Thank you!

Marie
Marie, you can create a Log File that Tracks which Logged User made changes to data in a specific Form, at a give Date and Time, and it will also list the Primary Key Number of the Record that was changed. Copy and Paste the following Sub-Routine in a Standard Code Module. In its simplest Format, it will create a Log File in C:\Changes.txt that will list the changes made in order. Place the Sub Procedure Call in the AfterUpdate() Event of any Form for which you want to track data modifications:
Expand|Select|Wrap|Line Numbers
  1. Public Sub TrackChanges(strUser As String, frmName As String, lngPrimaryKey)
  2. Dim Msg As String
  3.  
  4. Msg = Format$(Now(), "dddd, mm/dd/yyyy hh:mm AM/PM") & " - "
  5. Msg = Msg & strUser & " made changes to data in Form " & frmName
  6. Msg = Msg & " - {Primary Key Number " & lngPrimaryKey & "}"
  7.  
  8. Open "C:\Changes.txt" For Append As #1
  9. Print #1, Msg
  10.  
  11. Close #1
  12. End Sub
  13.  
Sample Call to the Sub-Routine
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_AfterUpdate()
  2.   Call TrackChanges(CurrentUser(), "frmEmployee", Me![PrimaryKey])
  3. End Sub
  4.  
Sample from C:\Changes.txt
Expand|Select|Wrap|Line Numbers
  1. Thursday, 11/08/2007 10:39 PM - Admin made changes to data in Form frmInventory - {Primary Key Number 74}
  2. Thursday, 11/08/2007 11:48 PM - John Doe  made changes to data in Form frmEmployee - {Primary Key Number 98774}
  3. Friday, 11/09/2007 08:05 AM - Bart Simpson made changes to data in Form frmInvoice - {Primary Key Number 876}
  4.  
NOTE: The above code was listed only as a simple Template, make your own changes to suit your specific needs.
Nov 9 '07 #2
Hi,

I'm creating a database and I need to find a way to track the changes to a record, more exactly, I need to know who makes changes to each record, as the users can only modify their own records.

I have one table where all the data is stored and I have between 50-100 users. Due to the high number of users, I would like to use the Windows login user ID instead of having to create user ID in Access. Is it possible? If yes, what is the code to be able to get the information (who changed the record) added to my table?

Thank you!

Marie
Hello Marie,

Take a look at my blog entry
Tracking changes in Access
this should do what you need.

Bill Mitchell
Nov 11 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Nicole | last post by:
Hello: I have a shared database running on a network drive. I would like to track when record changes occur and who did it. Problem 1: I'm not able to tack changes, when they occur in...
2
by: Uwe Range | last post by:
Hi to all, I am developing a database where, with time, it proved to be necessary to keep track of the changes to the data. It is fairly easy to keep track of the time when a record was changed...
1
by: Gomez | last post by:
I have set up two tables ****current and ****history. The history table contains all the fields which I want to track changes on. The current table contains just the most recent information from...
1
by: strvariant | last post by:
Hi all, I am searching for a way to track when a form/report/query is changed by users. For instance: 1) A user opens a form/report 2) The user enters the Design mode of that form/report ...
30
by: Charles Law | last post by:
Here's one that should probably have the sub-heading "I'm sure I asked this once before, but ...". Two users are both looking at the same data, from a database. One user changes the data and...
1
by: mankolele | last post by:
Hi all Is there someway to track changes made to data in a mysql database? Like someone changes a phone number in a record on a form -Is there a way to find out what changes were made to what...
2
by: De_Cisse | last post by:
Hi all, I'm working on an application in which I already make some preparations to be able to work in a frontend and backend database, even if this isn't the issue a this moment. I'm using VBA...
20
by: John Sheppard | last post by:
Hello there, Does anyone know of a way to track changes to an SQL Server database so that I can easily run those changes at a later date? That is, I want to make schema changes, and record...
3
by: dirksza2009 | last post by:
Hi, I've made a multi user (4 end users) database in Access 2000. I've made data tables, reference tables etc which sits on a shared drive and I've made individual front ends for the end users...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.