Solved

Display time on a form

Posted on 2014-01-31
7
265 Views
Last Modified: 2014-02-01
I have a date time field on a form displaying like:

1/13/2014 2:14:58 PM

But I want it to just display the time like:

14:14 (military time)

with no date or seconds.

How can I do this?
0
Comment
Question by:SteveL13
  • 4
  • 3
7 Comments
 
LVL 50

Expert Comment

by:Gustav Brock
ID: 39824180
Apply the format to the textbox: hh:nn

/gustav
0
 

Author Comment

by:SteveL13
ID: 39824213
I put hh:nn in the format line of the form properties and still get

1/13/2014 2:14:58 PM
0
 
LVL 50

Expert Comment

by:Gustav Brock
ID: 39824242
It's the Format property of the textbox bound to the field. It will work if the data type is Date.

/gustav
0
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 

Author Comment

by:SteveL13
ID: 39824569
It's an unbound text box that gets it's value from an afterupdate event of a combobox query.

That part of the SQL for the query is:

tblPreparation.EndTime AS TOC

Do I need to alter that somehow?
0
 
LVL 50

Accepted Solution

by:
Gustav Brock earned 500 total points
ID: 39824593
Yes and no. The checkbox returns a string.

You could try converting the value:

    Me!txtTime = TimeValue(Me!cboTime)

still using the hh:nn format, or - to force the time to a string:

    Me!txtTime = Format(Me!cboTime, "hh:nn")

or, if that fails:

    Me!txtTime = Format(TimeValue(Me!cboTime), "hh:nn")

/gustav
0
 

Author Comment

by:SteveL13
ID: 39825041
This worked...  Thanks.

Me!txtTime = Format(Me!cboTime, "hh:nn")
0
 
LVL 50

Expert Comment

by:Gustav Brock
ID: 39825192
You are welcome!

/gustav
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question