Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Format Date field in Access

Posted on 2013-05-21
5
Medium Priority
?
929 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 2000 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
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.
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…

721 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