-
Solved: move delete query from access query builder to code
I am trying to transfer my delete query from access query builder to VBA to hardcode it and am having problems , I think the compiler isn't happy with "Date < Date -60" but not sure how to make the compiler happy on this one, I have even tried declering date as a string stdate and that didn't seem to help
[VBA]
DoCmd.RunSQL "Delete IndividualSettingsTbl.Date" & _
"From IndividualSettingsTbl" & _
"WHERE IndividualSettingsTbl.Date < Date - 60;"
[/VBA]
-
Date is a bad column name to use. If you're after the actual Date() function you need brackets, but if you're after your column name you need [Date] square brackets. Also, you're missing a space before From and Where.
-
Ben Thanks, im stuck with the "Date" colume, this is kind of an after thaught, will try and let you know what happens
-
Did Date() work? Rather than just saying -60 you might want to try DateAdd to give you exactly 2 months.
-
oh... I thaught I replyed to this a few days back but I guess I didn't , Yes it did work, Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules