Solved

Format Date field in Access

Posted on 2013-05-21
5
916 Views
Last Modified: 2013-05-21
Hello,

I have a field in an Access Form that pulls from a date field in a SQL database.  The format is like this:

2013-12-25

The problem is that I want to format the field in Access to look like this:

12/25/2013

but still be able to edit it with in the Access form if I want.

Thanks,
Joel
0
Comment
Question by:Genius123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 35

Expert Comment

by:YZlat
ID: 39184739
you could use Format function

Format (MyDate, "mm/dd/yyyy")
0
 
LVL 11

Accepted Solution

by:
datAdrenaline earned 500 total points
ID: 39184966
Using a function to display the value the way you wish will render the value un-editable.  you will want to set the Format property of the TextBox control used to display the Date/Time typed value with this:

mm/dd/yyyy
0
 
LVL 11

Expert Comment

by:datAdrenaline
ID: 39185002
If you are looking at the table contents in DataSheet view, then you will have to go into Design Mode of the Table object and change the Format property of the Date/Time field in question.  Do take note, however, that the format of how a Date/Time datatype field (column) is display has no effect on how the value is stored.  Date/Time values are always stored as a serial number that represents the number of days away from a 'base date'.  The base date (a serial number value of 0.0) is 1899-30-12 12:00AM in the scope of VBA and an Access Database Engine file.  In SQL Server, the base date is 1900-01-01 12:00AM, but when you create a Linked Table object in the Access UI environment, the ODBC driver knows how to handle this discrepancy in serial number base dates when viewing/using you data through the Linked Table object.  Also, note that with the serial number, the whole number of the floating point value represents the number of days away from the base date, the fractional part represents the time of day (the portion of the day away from midnight).
0
 
LVL 19

Expert Comment

by:Eric Sherman
ID: 39185540
For the Date Text Box Control on your form, set the following properties:

1.) Input Mask .....  99/99/00;0;_
2.) Format ....  mm/dd/yy


ET
0
 
LVL 11

Expert Comment

by:datAdrenaline
ID: 39185689
I personally really really dislike input masks! ... :) ... The Access UI does a pretty good job with out them.  With out an input mask, the user can enter a date in several valid date formats and the Access UI will "know" that it is a date and accept it, and display the value in the format indicated in the Format property (if it is set) or in the default format for that datatype.
0

Featured Post

Free Webinar: AWS Backup & DR

Join our upcoming webinar with experts from AWS, CloudBerry Lab, and the Town of Edgartown IT to discuss best practices for simplifying online backup management and cutting costs.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
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.

763 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