Time/Date Recorded when Combo Box value changed

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
 
K

Ken Snell \(MVP\)

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
 
A

Al Campagna

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."
 

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