Date field format in DataGrid bound to Access Database. VB6.

Posted on 2005-05-03
Last Modified: 2013-12-25
I have a DataGrid control bound to an Access database with several date fields. I want the dates in my datagrid to display with the zeros, such as "06/14/2004", "09/01/2003", etc... Unfortunately it seems that Access only allows me formats that strip the leading zeros from days and months: "6/14/2004", "9/1/2003", etc... Is there any way around this? Either in the datagrid display, or in the table in Access?
Question by:Melvinivitch
    LVL 75

    Expert Comment

    by:Anthony Perkins
    This is unrelated to MS Access.  The Format in the table is striclty an Access thing.  You need to format the value in the data grid.

    Author Comment

    It's unrelated to Access but the Format in the table is strictly an Access thing? ... Not sure I follow...

    And how do I format the values in the data grid?
    LVL 48

    Accepted Solution

    or you may change format your date in your sql statement, like:

    select *, format(mydate, 'mm/dd/yyyy') as newdate from mytable where condition = true

    then just bound the grid column to "newdate" and it will display the date in the format you desired.

    Hope this helps, regards

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
    When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
    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…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    733 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

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now