Default Value Time() question

  • Thread starter Thread starter Silvio
  • Start date Start date
S

Silvio

I am using Time() as default value for my date/time control. However, the
system stores the full time, meaning hour, minute and seconds. How can I get
it to "store only" the hour and minutes? (e.g. 15:32 and not 15:32:36)

Thank you folks
 
You can't. A date/time value is stored as a date/time value.

However, you CAN get Access to DISPLAY only the hhnn portion. Take a look
at "Format" in Access HELP.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Hi Silvio,

As Jeff said you cannot not store the seconds. But you can get it to
default to just hours and minutes with zero seconds:

For hour/minute just past:

TimeSerial(Hour(Time()),Minute(Time()),0)

For nearest hour/minute:

TimeSerial(Hour(Time()),Minute(Time())+IIf(Minute(Time())>=30,1,0),0)

Hope that helps,

Clifford Bass
 
Hi,

It would depend on the end goal. Is there going to be time math
involved later on? Then the presence of seconds could well make a
difference. For display purposes only? Nothing wrong there. Unless you
want the nearest minute.

My $0.02 worth,

Clifford Bass
 
The challenge is that occasionally the user need to change the time before
saving the record. It becomes messy when you see only the date and time as
mm/dd/yyyy hh:mm and then when you click in it to change the time you get
extra item hh:mm:ss to fill in. I am afraid that they will start to change
the seconds instead of the minutes because of the visual effect.
 
Back
Top