• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 631
  • Last Modified:

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

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?
1 Solution
Anthony PerkinsCommented:
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.
MelvinivitchAuthor Commented:
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?
Ryan ChongCommented:
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now