Logging changes in a database for a field?

G

Guest

Does anyone know if there is a way of logging changes in a database?

I am trying to keep track of lead time changes in a database. For a
vendorID, everytime its leadtime changes, i want to be able to log the date
the change was made and what the value of the lead time was before the change
and what it is after the change. (I have a table with fields vendorID,
NewLeadTime, OldLeadTime as the relevant fields for this question).

Any ideas?
 
C

Carl Rapson

arsenalattack007 said:
Does anyone know if there is a way of logging changes in a database?

I am trying to keep track of lead time changes in a database. For a
vendorID, everytime its leadtime changes, i want to be able to log the
date
the change was made and what the value of the lead time was before the
change
and what it is after the change. (I have a table with fields vendorID,
NewLeadTime, OldLeadTime as the relevant fields for this question).

Any ideas?

Add a Date/Time field to your table and set the Default Value to Now().
Every time a new record is added to your table, the Date/Time field will
automatically be filled in.

Carl Rapson
 
G

Guest

How do I log the old leadtimes though so I can see what they were before they
were changed?
 
G

Guest

What i mean is...according to what your saying, i'd have to create and new
field everytime i make a change to a LT. If i make 20 Lead time changes over
the next 2 years, I want it to report what the lead times were and when they
were changed.

I'm wondering if this can be an automated process in form of a log.
 
G

Guest

You need a tblLeadTime table. It would have the following fields:
LeadTimeID (PK) VendorID (FK) LeadTime LeadTimeChgDate

The default value of the LeadTimeChgDate field would be Now(). Then you
could tell what the lead time was in the past for as many changes as needed.
 
G

Guest

Ok. Thanks, this helps.

If i make this change in the main table which i am currently doing, do you
know if there is a way for -in another table -to have access create a new
record for that change so I dont have to record the change in 2 different
tables? I don't think there is, just checking though. Thanks mvp.
 

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