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

StagIraq used Ask the Experts™
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 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.


Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
See if this works:

=Format(DateAdd("n",-15,[TextbriefTime]),"hh:mm") & " - " & Format(DateAdd("n",165,[TextbriefTime]),"hh:mm")



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.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial