BerkErgun


I would like to open a report in Access VBA , using a date filter and at Turkish operating system that Ií»m using, the date format is DAY/MONTH/YEAR.

Unfortunately, Ií»m experiencing a big problem regarding date format. At present, below I tried to explain the problem Ií»m facing:

For example; if I write 30/06/07, program defines it correctly as 30th of JUNE because there isní»t a 30th month but if I write 03/06/07, it defines as 06th of MARCH.

Please kindly advise how I can solve this matter




Re: Using a date filter for opening a report in Access VBA

Cringing Dragon


You have to be careful with dates because MicroSoft (and other US developed) products tend to default to the US date system of month/day/year. You may need to format your date to the US system.

I know nothing about the Turkish operating system, but I assume that the date formatting will work in any language.

The first thing to try, if the date in question is typed directly into the VBA and is not a variable or a formula, then type the month in words instead of numbers. For example 03/June/2007. I also suggest you use a 4 digit year, just to be safe.

If the date is not typed in, but is a variable, then you'll need to use some sort of format function to convert it.

I'm more familiar with Excel than Access, so my suggestions may not quite work, but will hopefully give you a starting point. Access and Excel functions are very similar, but have some differences.

In Excel, the following code should do the trick:

Format(myDateVariable, "mm/dd/yyyy")

I think that the Access equivalent is a TEXT function, but I may have the syntax wrong:

Text(myDateVariable, "mm/dd/yyyy")

If that doesn't work, try looking up Access help on TEXT or FORMAT for the correct syntax.

I hope that helps, and isn't too confusing.







Re: Using a date filter for opening a report in Access VBA

BerkErgun

I solved my problem finally. You are so kind ,thank you very much for your help.

Best regards, have a nice day.