Reputation:
As typical MS Access is making simple things hard...
The two lines:
now = now()
twoYearsAgo = DateAdd("m", -24, now)
produces the error on the second line:
Object Required
Before it also had an error about an array...
Upvotes: 0
Views: 522
Reputation: 56026
You are effectively doing:
now = now
So do like this:
Dim ThisMoment As Date
Dim TwoYearsAgo As Date
ThisMoment = Now
TwoYearsAgo = DateAdd("m", -24, ThisMoment )
Upvotes: 1
Reputation: 1034
There are a number of reserved words, properties in Access VBA. This might help:
Problem names and reserved words in Access
Upvotes: 2