Solved

How does Access know when to put AM vs. PM?

Posted on 2011-03-25
17
508 Views
Last Modified: 2012-05-11
We have an Access 2003 database that was created around 1998 in Office 97. We later added a table and form in which people put the start and end times (Medium Time format) for jobs they perform. Because some people had 20 or more entries we did not request that they add AM/PM. We were most concerned about the length of time and could calculate that even if the computer assigned AM when it should be PM. We did not even display that part of the time in the form.
Now we have need for the AM/PM stamp to be correct and that raises the question of what happens when we type 2:35 in the control? How does Access or Windows decide which to put behind the entry? It seems that it guesses well most times but not all times. It is important to understand these entries can be made hours or days later than the times they represent. Any ideas?
0
Comment
Question by:decraneit
  • 4
  • 4
  • 3
  • +2
17 Comments
 
LVL 75
ID: 35218839
Unless you have used a specific Format, it's determined by the Regional settings in Control Panel.

Keep in mind that ... Access stores dates/times (Date/Time data type) as double precision numbers internally, left of dec pt is the date, right of dec pt is the time.  So ... not sure you need to be concerned.

mx
0
 
LVL 5

Expert Comment

by:KPAYNE123
ID: 35218857
I would check the Regional settings for Windows.
0
 
LVL 2

Author Comment

by:decraneit
ID: 35218890
I realize I failed to make one thing clear. We have formatted the field as Medium Time format so it will have to have either AM or PM behind the number. If all we type is 2:35 and hit enter, how is it decided which to put, AM or PM, behind the 2:35.
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 75
ID: 35218916
0
 
LVL 21
ID: 35218922
0 to 11:59:59 is AM.
12:00 to 11:59:59 is PM

Data entry It works like this:

2:35  is always AM

If you want PM you must enter:

2:35  PM   or  14:35


If the time span can cross midnight ( 0 ) or the length on a span can be longer than 24 houor you will need to store the date with the time for both stating and ending times..
0
 
LVL 21
ID: 35218952
Opps ..

Should have said:

0 to 11:59:59 is AM.
12:00 to 23:59:59 is PM

This is for data entry.

If you are entering tim in 12hour not 24hour notation you must include PM to gt noon or later.
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 250 total points
ID: 35218963
"how is it decided which to put, AM or PM, behind the 2:35."
It's not. You have to decide.

That's why ... I personally only use 24 hr time.

mx
0
 
LVL 44

Expert Comment

by:GRayL
ID: 35218985
If you run this in the Immediate Pane (Alt+F11):

? format(#2:35#,"hh:mm am/pm")
02:35 am
? format(#14:35#,"hh:mm am/pm")
02:35 pm
0
 
LVL 2

Author Comment

by:decraneit
ID: 35219056
OK, here is the form with some entries I have made. Things were going swimmingly as I entered the first 6 entries, but on the 7th entry I got 4:30 AM even though I had been gatting PM right before that. I confess I have been fooling around with some code to try to logically determine the most likely choice but I was having similar experiences before I started checking the entries. Notice the two highlighted, in green, entries
0
 
LVL 21
ID: 35219096
I agree with mx. Access does not decide AM/PM. It takes whatever you enter.

I only use 24 hour time for data entry.  Eliminates the confusing.
0
 
LVL 44

Assisted Solution

by:GRayL
GRayL earned 250 total points
ID: 35219351
Another thing, you've had the guy on the job since 4:00 am and it looks like you haven't allowed him/her to take breakfast or lunch;-)  It looks like once you enter the Start Time for the first Job of the day for that person, when you go to a new record, the only thing you should have to fill in is the End Time as the Start Time is always the End Time of the previous record.  Is that automated?
0
 
LVL 44

Expert Comment

by:GRayL
ID: 35233467
Thanks, glad to help.  
0
 
LVL 75
ID: 35233500
I just wanted to note that .. the actual answer to the question "How does Access know ..."  is @ http:#a35218963 :-)

IE ... Access does not.

mx
0
 
LVL 21
ID: 35233795
I agree with mx.
0
 
LVL 2

Author Comment

by:decraneit
ID: 36209889
Sorry, but I got busy and missed out on some of this last discussion. In retrospect, your decision is the correct one - I apologize for not seeing that the first time. Thanks.
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

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…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

735 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