Date notation swop via VBA-Filter

  • Thread starter Thread starter mddickie via AccessMonster.com
  • Start date Start date
M

mddickie via AccessMonster.com

I'm trying to filter a form via VBA on a specific date:
{formname}.filter = "Date = #" & MyDate & "#"

Unfortunately the date notation swops in the Form window so i filter on a
complete other date.

In VBA: dd/mm/yyyy
In Form: mm/dd/yyyy

Who can help me?
 
Mddickie,

Is Date the name of a field? Is so, the first thing to mention is that
Date is a Reserved Word (i.e. has a speciqal meaning) in Access, and as
such it should not be used as the name of a field or control. I would
recommend changing it, but in the meantime it should be enclosed in []s
in your code and expressions to reduce the probability of problems.

And what is MyDate? Is it a date variable which you have declared and
assigned a value to in the preceding code? If so, how is th vaue
assigned to it. VBA will assume a date is in American format, so you
either need to explicitly format a date as such, or use the numerical
value of the date (via the CLng() function).
 
Back
Top