WineSnob
Not Bright but TENACIOUS
- Local time
- Today, 06:56
- Joined
- Aug 9, 2010
- Messages
- 211
This code works
varWhere = varWhere & "[Month] Like """ & Me.txtstartmonth & """ "
When I try to add a between
varWhere = varWhere & "[Month] Between """ & Me.txtstartmonth & """ AND """ & Me.txtendmonth & """ "
I get a "data type mismatch in criteria expression" error.
[month] is a number
txtstartmonth is a number
txtendmonth is a number
If I go directly to the query and use Between 1 and 5 the query runs fine.
Here is the Debug.Print varWhere
[Year] LIKE "2011" AND [Month] Between "1" AND "5"
What am I missing?
varWhere = varWhere & "[Month] Like """ & Me.txtstartmonth & """ "
When I try to add a between
varWhere = varWhere & "[Month] Between """ & Me.txtstartmonth & """ AND """ & Me.txtendmonth & """ "
I get a "data type mismatch in criteria expression" error.
[month] is a number
txtstartmonth is a number
txtendmonth is a number
If I go directly to the query and use Between 1 and 5 the query runs fine.
Here is the Debug.Print varWhere
[Year] LIKE "2011" AND [Month] Between "1" AND "5"
What am I missing?