Solved

Display time on a form

Posted on 2014-01-31
7
263 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 49

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 49

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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

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 49

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 49

Expert Comment

by:Gustav Brock
ID: 39825192
You are welcome!

/gustav
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

789 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