Avatar of StagIraq
Flag for United States of America asked on

How to format default value for time in a text box?

This will be easy for someone out there...but it is beyond my capabilities...

I'm using Access 2010.  I am designing a form to be easy to update when the time changes happen throughout the year and our company shifts its office hours around.

My input form has start times for different events.  Overarching of the star times, there are other times built into the schedule (plus/minus the start time).

I needed the times in all of the unbound textboxes to be based upon one field.  I put the following into the fields' default Data properties.


that works fine (except not in 24hr format).  I then derived a concatenated version to cover the overarching time period (minus 15 minutes and then three hours long) as shown here:

     =DateAdd("n",-15,[TextbriefTime]) & " - " & DateAdd("n",165,[TextbriefTime])

This does the calculation perfectly.  The problem is I have Short Time as the format for the textbox and the concatenated version returns a solution of:
5:15:00 AM - 8:15:00 AM

I want 24hr time and no seconds shown...at best I've been only able to get the short time for the single time above to be 5:15, but I do not know where to start with the concatenated overarching textbox (to get it to stop with the seconds and the AM/PM).

Help is always appreciated.


Microsoft Access

Avatar of undefined
Last Comment

8/22/2022 - Mon

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

Flyster,  That did the trick.  I was even able to use the formatting to fix most of the single times I mentioned.  

I say most because they are all based upon the original field.  I have properly formatted all but the original.  I've left a "5:15" in the original for now, but I will hopefully figure it out to make it "Hhmm" like the others to show my 24hr time.

Thanks again!

Thanks. Glad I couls be of assistance.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes