Does anyone know how to reference a variable to be interpreted as a date in an SQL string. I keep getting a "type mismatch" error. I know the field, usdatabase.TransactionDate will accept only dates.
I have tried substituting the &'s in the sevenyearsago variable with #, and it doesn't work.
Here are the relevant 2 lines of code:
sevenyearsago=DateAdd("m",-84,now)
sqlSTR="DELETE usdatabase.*, usdatabase.TransactionDate FROM usdatabase WHERE usdatabase.TransactionDate < '"&sevenyearsago&"'"
Any help will be more than appreciated.
I have tried substituting the &'s in the sevenyearsago variable with #, and it doesn't work.
Here are the relevant 2 lines of code:
sevenyearsago=DateAdd("m",-84,now)
sqlSTR="DELETE usdatabase.*, usdatabase.TransactionDate FROM usdatabase WHERE usdatabase.TransactionDate < '"&sevenyearsago&"'"
Any help will be more than appreciated.