Auto enter date and time

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form based on a query of appointments. I want to be able to have
the user enter the appointment number (I've used a combo box to allow this),
and have the arrival date and arrive time (two separate fields, I know, not
cool, but I inheireted it this way) automatically populate.

I can't believe I'm having such difficulties with this.

BTW---Access 97
 
Boz,
Where are the Dates and Times coming from. Have they already been captured in a table
along with the ApptNo?
If so, you can add the date and time columns to your ApptNo combo, and use 2 calculated
unbound fields to "display" the associated D&T.
(Don't use Date and Time as names... use ApptDate or ApptTime for ex.)
cboApptNo combo setup ex...
ApptNo ApptDate ApptTime
1425 1/1/07 14:45

txtApptDate Control Source...
= cboApptNo.Column(1)
txtApptTime Control Source...
= cboApptNo.Column(2)

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."
 
The date and time is not already captured in the table. The purpose of this
form is to enter the arrival date and time (without giving the user the
opportunity to mess up the correct date and time)
 
try adding the following code to the "appointment number" control's
AfterUpdate event procedure, as

If Not IsNull(Me!ApptTimeFieldName) Then
Me!ArrivalDateFieldName = Date
Me!ArrivalTimeFieldName = Now
End If

hth
 
Open the Table n design view, for each of the fields there is a DefaultValue
property.
In the Default you can write
=Now

So every time a new record is added the table, the Date and time will be
added to autmatically to the record in that specific field

=Date()
Will add the date without the time
 
Back
Top