Access 97 date and time

J

John Evans

Is it possible to enter a date AND time in a SINGLE form
field then use the entry for datediff calculation with
another date field.
 
R

Rick Brandt

John Evans said:
Is it possible to enter a date AND time in a SINGLE form
field then use the entry for datediff calculation with
another date field.

You might be surprised to know that it is not only possible,
but it is mandatory. Date/Time fields in Access always
include both a date and a time. When you enter only a Date
Access defaults the time to midnight and when you enter only
a time, Access defaults the date to 12/30/1899.

The deafult formatting in Access is to hide the time
midnight and the date 12/30/1899 so when looking at the
datasheet it appearts that those default "pices" aren't
there, but they are.

When entering both into a field/control, just separate them
with a space.

EX:

7/7/2003 7:47 PM
 
J

John Evans

Thanks Rick - I can now enter the data into one field on
the form but access does not like it - says the datatype
is wrong or too large for FieldSize -forgive my stupidity
but how do I change this. The option general date seems
the most appropriate but has time as longtime setting not
short time. I've tried many times to find an acceptable
way of doing this but am running out of ideas.
Thanks

John Evans
 
R

Rick Brandt

John Evans said:
Thanks Rick - I can now enter the data into one field on
the form but access does not like it - says the datatype
is wrong or too large for FieldSize -forgive my stupidity
but how do I change this. The option general date seems
the most appropriate but has time as longtime setting not
short time. I've tried many times to find an acceptable
way of doing this but am running out of ideas.
Thanks

Is the underlying field a DateTime DataType? I just tried
this on a test form with a date field. I used no format
property at all and I was able to make entries in a variety
of formats. All were accepted.
 
V

Van T. Dinh

Open the Table in Design View. Check the Data Type of the
Field and make sure it is of Date/Time type.

You probably has it as Number Type of Field Size Integer
or Byte.

HTH
Van T. Dinh
MVP (Access)
 
J

John Evans

Thankyou again

The field type was right (General Date) but the input mask
was wrong. I'v edited the short date to accept time and it
now works using the same input mask for the form. The only
issue left to solve for me is how to get the form to
display the time part of the date/time as short time - it
displays it as long time as per General Date field -anyway
it's not too important. Thanks for helping sort out a
problem I've had for some time now.

Regards

John Evans
 

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