ryan.gillies
Registered User.
- Local time
- Tomorrow, 02:52
- Joined
- Apr 8, 2011
- Messages
- 53
Hi all - I have an extremely frustrating problem with date formats in Access/VBA and hope you can help!
We generate a large number of reports here, and often end users will be looking at dates in particular. I just about been able to ascertain that regardless of what date it is, Excel always uses the MM/DD/YYYY format.
Access and the associated VBA we generate for it is proving less reliable however. Towards the end of last month it was very happy accepting dates in DD/MM/YYYY format (presumably because you can't have the 11th of the 30th month in 2011). However now its switched around, and is treating dates as MM/DD/YYYY - so today's date (8 Dec 2011) is actually being treated as 12 Aug 2011.
I've tried using format to structure the date this way, but Access/VBA still sporadically treats in reverse anyway, and changes it back to the other format - there seems to be no consistency to it! I've even tried using DateSerial and it still gets it wrong.
I'm slowly going insane - is there a better way/different approach I can take to using dates? I know dates are stored as a number, can I use that format instead to make it more reliable?
We generate a large number of reports here, and often end users will be looking at dates in particular. I just about been able to ascertain that regardless of what date it is, Excel always uses the MM/DD/YYYY format.
Access and the associated VBA we generate for it is proving less reliable however. Towards the end of last month it was very happy accepting dates in DD/MM/YYYY format (presumably because you can't have the 11th of the 30th month in 2011). However now its switched around, and is treating dates as MM/DD/YYYY - so today's date (8 Dec 2011) is actually being treated as 12 Aug 2011.
I've tried using format to structure the date this way, but Access/VBA still sporadically treats in reverse anyway, and changes it back to the other format - there seems to be no consistency to it! I've even tried using DateSerial and it still gets it wrong.
I'm slowly going insane - is there a better way/different approach I can take to using dates? I know dates are stored as a number, can I use that format instead to make it more reliable?