Solved

Display time on a form

Posted on 2014-01-31
7
256 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
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.

929 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now