Date/time field

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

John Vinson

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
 

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