Marjan has attended:
Access VBA course
Access VBA course
Access VBA
Is it possible to change the date format in VBA editor to European style?
Thanks
Marjan
RE: Access VBA
Hi Marjan,
Sorry for the delay in answering your question.
What's European style?
You can Format a date to your liking using VBA's Format function, which has the structure:
Format ( expression, [ format, [ firstdayofweek, [firstweekofyear] ] ] )
where:
'expression' is the value to format.
and 'format' (optional) is the format to apply to the expression.
You can either define your own format or use one of the named formats that Excel has predefined such as: General Date, Long Date, Medium Date, Short Date, Long Time, Medium Time, Short Time.
When defining your own format, you can specify how the date appears using 'y' for year, 'm' for month, and 'd' for day of month. But you need to specify them multiple times to get the right format. Eg. For year 2008, 'yy' gives you '08', whereas 'yyyy' gives you 2008. Experiment with the others (it's similar to the date format when you're formatting a cell in Excel).
Examples:
Format(#7/06/2005#, "yyyy/mm/dd") would return '2005/06/07'
Format(#7/06/2005#, "Short Date") would return '7/06/2005'
Format(#7/06/2005#, "Long Date") would return 'June 7, 2005'
I hope this helps you change your date to 'European style'.
If you require further assistance, please reply to this post and I'll give you some more info based on your response.
Have a great day.
Kind regards, Rich