Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Display time on a form

Posted on 2014-01-31
7
Medium Priority
?
278 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 52

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 52

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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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 52

Accepted Solution

by:
Gustav Brock earned 2000 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 52

Expert Comment

by:Gustav Brock
ID: 39825192
You are welcome!

/gustav
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

824 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