Writing Data to New Table

  • Thread starter Thread starter scott04
  • Start date Start date
S

scott04

Hi all,

I have records that upon the status being marked completed fires code to log
=Now(). From time to time the status needs to be changed back to InProgress.
If there a way i can write a record to a table everytime this is marked
complete with the now() and primary key field called LifeID? I have utilized
Allen's audit trail for other databases but i am not interested in capturing
all fields just LifeID and DatePAComplete. Any nudges in the right direct is
appreciated.
 
1. In the General Declarations section (very top) of the form's module:
Private mbStatusOld As Boolean

2. In the form's Current Event:
mbStatusOld = Nz(Me.[Status], False)

3. In the form's AfterUpdate event:
Me Me.[Status].Value <> mbStatusOld Then
'execute an append query to write the log.
End If

I suggest your logging table contains a field for Status as well as LifeID
and DatePAComplete, as the code above will trigger when someone turns the
status off again (not only when they turn it on.)
 
Allen said:
1. In the General Declarations section (very top) of the form's
module: Private mbStatusOld As Boolean

2. In the form's Current Event:
mbStatusOld = Nz(Me.[Status], False)

3. In the form's AfterUpdate event:
Me Me.[Status].Value <> mbStatusOld Then
'execute an append query to write the log.
End If
Me Me?
That one's to good to pass up.
IF only Me had thought about it.

My favorite is
If Something
do this
end if.

I frequently assume that since I thought it Access should know.
 
Back
Top