Date/time field

  • Thread starter Thread starter Dave Mainland
  • Start date Start date
D

Dave Mainland

Help! I am interested in how to populate a date field in
a form with the current date, but only when a preceeding
field is populated. After completing a service for a
customer, the fee is entered. When this fee is entered, I
would like the current date to populate the
succeeding 'invoice date' field when the field gets
focus. Any help would be greatly appreciated.
 
Help! I am interested in how to populate a date field in
a form with the current date, but only when a preceeding
field is populated. After completing a service for a
customer, the fee is entered. When this fee is entered, I
would like the current date to populate the
succeeding 'invoice date' field when the field gets
focus. Any help would be greatly appreciated.

You must do this on a Form - table datasheets don't have any usable
events. Use the AfterUpdate event of the Fee control; invoke the Code
Builder; and put something like

Private Sub Fee_AfterUpdate() ' Access gives you this line
If Not IsNull(Me!Fee) Then ' Did the user enter anything?
Me!txtInvoiceDate = Date ' or Now if you want the date & time
End If
End Sub ' Access gives you this too
 
Back
Top