Thanks a lot for your help. Actually I need to view the date in the following format but not to change it in the database:
dd/mm/yyyy
Could you please help me in this regard? I am using MS Access database "Sales.mdb", Table name is "Collections" & field name is "DepositDate"
I need to view the complete column/field in the above format.
Regards,
Sneha.
[Edited by sneha on 23-07-2006 at 08:54 PM GMT]
[Edited by sneha on 23-07-2006 at 08:57 PM GMT]
____________________________
Sneha
____________________________ Attached:
23-07-2006 at 12:44 PM
|
GeoffS Level: VB Lord Registered: 29-09-2004 Posts: 536
Re: MSHFlexGrid Date Format ...
Hi Sneha,
Access will always display the date according to your localisation, so if your locale is set as U.S. then it will store and display dates in the mm/dd/yyyy format, which means that if you supply a U.K. formatted date (dd/mm/yyyy) to the database, and it can represent a valid U.S. formatted date, such as 1st. May 2006 as 01/05/2006 then the date may well get changed to 5th. Januuary 2006. When you bind the MSHFlexgrid directly to data then it will display that data in the format in which it is retrieved. As far as I am aware you cannot set a column property of the control to force a particular date format, you will have to retrieve the data into memory and then allocate it to each cell, applying the formatting as I described above.
If you are having problems with dates it is worth bearing in mind that the underlying data type that Access actually uses to store the date is a numeric data type - a Double - where the whole number represents the number of days elapsed since 30th. December 1899 and the decimal part represents the time. So you could convert your dates to a Long (get rid of the decimal otherwise you will never get a date = date because the time portion will be different) and store it that way. Then you can get it to display in any way that you want by simply formatting the text box or whatever control you display it in.
Dates are a problem for a lot of us - take a look at this previous thread which may cast a bit more light for you:- http://www.andreavb.com/forum/viewtopic.php?TopicID=6501&page=0#21959
____________________________ multi-tasking - the ability to hang more than one app. at the same time.