473,811 Members | 2,485 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Track changes to a record in Access

14 New Member
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 9314
ADezii
8,834 Recognized Expert Expert
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
wvmitchell
42 New Member
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
4512
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 subforms. (I have a main form with 3 subforms) Problem 2: for CurrentUser I'm currently getting "admin", since I don't have any security levels set up, however everybody in our system
2
4191
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 (afterupdate event) -> Is there there a smart way of finding out which field has been changed? I don't want to set a procedure on every field on the edit form for keeping track of that, because the forms will be changed from time to time.
1
1589
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 those fields (history not important). The entry forms are set up with a query to access each field from it's correct table. I have a 2 field primary key in the history table (field 1 is a facility ID, and field 2 is the date of inspection). ...
1
2257
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 3) The user makes a change
30
3410
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 commits it. How does the other user get the updated view without polling for changes? Is there some sort of callback mechanism that can be set up on the dataset or connection? TIA
1
3510
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 fields for what records and when they were changed and what the record looked like before the change? And also record the logged in user that made the change? I know that there is supposed to be a seperate table for that. Thanks
2
3398
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 classes for this (I know not the easiest way, but I have made some considerations and I want to to it this way as VBA classes are some new stuff to explore for me). In a class 'client' I get the data from the database and put it in
20
3146
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 those changes so that I can execute them 6 months later on a copy of the orignal database. Thank you kindly for any ideas anyone may have John
3
4198
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 which gives them specific views of the data. I'd like to track all the changes made to a record which works find with the following code : basAuditTrail: Option Compare Database Const cDQ As String = """" Sub AuditTrail(frm As Form, recordid As...
0
9728
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10648
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10389
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10402
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7670
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3867
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3018
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.