Auto Date / Time entry

G

Guest

I am working on a database for a remote warehouse. I need to have several
Date / Time field autocompleted when the coresponding check box is checked.
below is a sample of data.

tbl tickets
*ID (autonumber PK)
ordernumber
date order printed (Date/Time)
orderreceived (Check box)
date order received (Date / Time)
order shipped (Check Box)
date order shipped (Date/Time)

I need the three Date / Time fields to auto complete when the data entry
occures in the ordernumber field and when the check box is check for order
received and order shipped.

Any help through VBA or Form coding would be a great help!

Barry
 
F

fredg

I am working on a database for a remote warehouse. I need to have several
Date / Time field autocompleted when the coresponding check box is checked.
below is a sample of data.

tbl tickets
*ID (autonumber PK)
ordernumber
date order printed (Date/Time)
orderreceived (Check box)
date order received (Date / Time)
order shipped (Check Box)
date order shipped (Date/Time)

I need the three Date / Time fields to auto complete when the data entry
occures in the ordernumber field and when the check box is check for order
received and order shipped.

Any help through VBA or Form coding would be a great help!

Barry
Code the AfterUpdate of the orderreceived check box control:
If Me![orderreceived] = -1 Then
Me![date order received] = Now()
Else
Me![date order received] = Null
End If

Code the other check boxes similarly.
 
J

John Vinson

On Mon, 23 Oct 2006 08:35:30 -0700, BDP III <BDP
I am working on a database for a remote warehouse. I need to have several
Date / Time field autocompleted when the coresponding check box is checked.
below is a sample of data.

tbl tickets
*ID (autonumber PK)
ordernumber
date order printed (Date/Time)
orderreceived (Check box)
date order received (Date / Time)
order shipped (Check Box)
date order shipped (Date/Time)

I need the three Date / Time fields to auto complete when the data entry
occures in the ordernumber field and when the check box is check for order
received and order shipped.

Any help through VBA or Form coding would be a great help!

Barry

This can be handled pretty easily with a little VBA code in the
AfterUpdate event of the checkbox. For instance, you might want to
view the Form's Properties; on the Events tab of orderreceived click
the ... icon and invoke the Code Builder. Access will give you the Sub
and End Sub lines; just add one more...

Private Sub orderreceived_AfterUpdate()
If Me.orderreceived Then ' did the user check it?
Me.[date order received] = Now ' insert current date/time
End If
End Sub

John W. Vinson[MVP]
 
G

Guest

Thanks Fred

your idea worked great for the check boxes, any thoughts on the oredernumber
/ order date/time field? What I need is the Time/ date field completed on
data entry of the order number.

Thanks agian.. Big help!

Barry
 
J

John Vinson

On Mon, 23 Oct 2006 10:48:01 -0700, BDP III <BDP
your idea worked great for the check boxes, any thoughts on the oredernumber
/ order date/time field? What I need is the Time/ date field completed on
data entry of the order number.

ummm...

Just use the same code for the other checkbox, making the appropriate
changes to the control names.

John W. Vinson[MVP]
 
G

Guest

The order number is not a check box (yes/no) field, however since it was a
number field I was able to accomplish by using this code


Private Sub ordernumber_AfterUpdate()
If Me![ordernumber] > 0 Then
Me![timeprinted] = Now()
End If
End Sub


Thanks again for the Help.

Barry
 

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