Solved

Format Date field in Access

Posted on 2013-05-21
5
913 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
  • 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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 …

832 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