I've been stuck on one small item for awhile and it's driviing me nuts. In short, I want to run a delete query in VBA to delete records containing a billing month that's greater that a precalculated current month. The source data from another system has the dates in text format, shown as (YYYY/MM).
Here's the statement:
mySQL = "DELETE * FROM [tblBillingData]" _
& "WHERE (((tblBillingData.[Billing Month]) > #" & PreCalcCurrentMonth & "#, ));"
When it runs, it deletes everything from the table, not just the items where the billing month is greater than the current month.
All variables are declared properly and I can see the PreCalcCurrentMonth when I step through the codeAny suggestions?
Should I be evaluating each recordset individually?
The pound (or number) character (#) has a numeric code of 35, i.e. lower than any numeric or alphabetic character. In a string comparison, a string beginning with # will always be smaller than any alphanumeric string.