Solved

Tracking table in Access

Posted on 2000-04-24
5
197 Views
Last Modified: 2010-05-02
Ok here is my question:
I have an access application that I use to enter sensitive information. If somebody makes a change to one record I want to be able to track the field that was changed the user name of the person who logged on to my database and the change made. I want to create a table that gets this information thru vb code or queries. Please send me sample code assuming a simple record with name, age, DOB fields and the mechanism to track changes to this record. Remember I need to know who did it, when, what fields were changed and what were the old and new values for those fields. thanks
0
Comment
Question by:jorgito4
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 12

Expert Comment

by:mark2150
ID: 2745141
I did this by adding a memo field to the data record. When you populate the fields place the *same* data into the .Tag of the control as you put in the .Text. Then at save time you watch to see if .Text=.Tag, if they don't, then you know that particular field has been updated. I then just add the info to the start of the memo field with something like:

DIM obj as Object
'
for each obj in Form.Controls
if typename(obj) = "TextBox" then
  if obj.text <> obj.tag then
    RS!memo = "Data Field" & obj.name & "changed from: " & obj.tag & " to: " & obj.text & " by: " & user & " on: " & format(now, "hh:mm dd-mmm-yy") & rs!memo
  endif
  '
endif
'
next obj

This is off the top of my head, but I have written this (the code is at home) and it DOES work.

M
0
 

Author Comment

by:jorgito4
ID: 2748429
I believe you understood what i am ying to do very well but i did not quite get the idea. Please clarify when you say:
1)"adding a memo field to the data record"
you mean adding a field to let's say the customer table that i am trying to track.
2)"populate the fields" means adding a new member right?
3)*same* what does this mean?
4)".Tag of the control as you put in the .Text" what control?, are you talking about the same text box where i am entering data?
5)Do you place the code that you gave me on the general section of the code window?
Thanks!!!!
0
 
LVL 12

Accepted Solution

by:
mark2150 earned 50 total points
ID: 2748674
1) Yes
2) When you fill your screen with data from the record you do:

Text1.Text = Trim("" & RS!Fieldname)
Text1.Tag = Text1.Text

3) Same means *same*
4) Yes
5) No, code goes in click event of [Update] button

M
0
 

Author Comment

by:jorgito4
ID: 2751352
Very helpful and knowledgeable. Excellent help.
Thank you Mark.
0
 
LVL 12

Expert Comment

by:mark2150
ID: 2751404
Thank you for the lovely points. They look really nice over the mantle. (grin)

M
0

Featured Post

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month9 days, 21 hours left to enroll

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question