Time/Date Recorded when Combo Box value changed

  • Thread starter Thread starter fiona.innes
  • Start date Start date
F

fiona.innes

Hi,

I have a form that records when freight enteres the warehouse which
has the fields
txtDate
txtDescription
cmbStatus
txtDestination
txtLocation

Which are stored in the table tblFreight

When a record leaves the warehouse the status of the record is changed
from "In Warehouse" to "Left Warehouse" ideally id like to add a
futher 2 fields called txtTimeOut txtDateOut which records
automaticalled the system time & date when the status is changed to
"Left Warehouse".

How to I achieve this???

Fie
 
Add the field to your table, and add it to the RecordSource query that is
used by the form.

In the AfterUpdate event of the control that contains the text "left
warehouse", use this code:

Private Sub NameOfControl_AfterUpdate()
If Me.NameOfControl.Value = "Left Warehouse" Then _
Me.txtTimeOut.Value = Time()
Me.txtDateOut.Value = Date()
End If
End Sub
 
Fie,
Use the AfterUpdate event of your combo (ex. name cboStatus) to update
one field with the current Date and Time.
(one field is all you should need... ex. txtDateTimeOut)
Private Sub cboStatus_AfterUpdate()
If cboStatus = "Left Warehouse" Then
txtDateTimeOut = Now()
End If
End Sub
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
Back
Top