Form filtering between dates

  • Thread starter Thread starter BrettsNEWS
  • Start date Start date
B

BrettsNEWS

Hi all, could anyone let me know how to filter out all records in a form
that are not BETWEEN two dates?

In VBA I have,

BetweenDate = "Between #1-Jan-2001# And #30-Dec-2003#"
StrCriteria = "[Order Date] = " & BetweenDate
DoCmd.ApplyFilter , StrCriteria

This comes up with Syntax error (missing operator) in query expression
'[Order Date] = Between #1-Jan-2001# And #30-Dec-2003#'.

thanks in anticipation,
Brett.
 
Hi all, could anyone let me know how to filter out all records in a form
that are not BETWEEN two dates?

In VBA I have,

BetweenDate = "Between #1-Jan-2001# And #30-Dec-2003#"
StrCriteria = "[Order Date] = " & BetweenDate
DoCmd.ApplyFilter , StrCriteria

This comes up with Syntax error (missing operator) in query expression
'[Order Date] = Between #1-Jan-2001# And #30-Dec-2003#'.

thanks in anticipation,
Brett.

The problem you're getting is due to the fact that you are using both
an = and a BETWEEN operator. Leave off the equals sign.
 
Brett,

You have got an extraneous '=' in your expression. Try this...
StrCriteria = "[Order Date] " & BetweenDate

You have put in an extra step in the code compared to how I would do
it. I would go straight to...
StrCriteria = "[Order Date] Between #1-Jan-2001# And #30-Dec-2003#"

- Steve Schapel, Microsoft Access MVP
 
Back
Top