Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Access Default Value with Today's Date specified time

Real quick question.
I’m trying to set a default value in an Access table that gives me today’s date and 8AM as the time.

I attempted to use =Date() & "8:00:00 AM" but I am getting a type mismatch error. I changed the format of the column to General Date to be able to have date and time but still no go.

Any help would be greatly appreciated.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You could build the desired date like that

dt = Date
dt = DateSerial(Year(dt), Month(dt), Day(dt))
dt = dt + TimeSerial(8, 0, 0)

A date is a number, 2020/02/08 is 44600. A time is a fraction, 8am is 0,333333333333333. If you want to build a date like Today 8 am you need to use the build-in functions Dateserial and Timeserial which gives you excatly the date you need.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading