The Table has about 250 Entries dated between January 1, 2005 and
January
31,
2005.
DateAdd("m",-1,Now()) ... No Responses.
DateAdd("m",-1,Date()) ... No Responses.
Month(DateAdd("m",-1,Now())) ... No Responses.
Month(DateAdd("m",-1,Date())) ... No Responses.
And even more confusing, I thought this worked when I took out the
other
Criteria. But it isn't working and right now this is the ONLY Criteria
in
the
Query. Ideally, I wanted all the Entries with the Status "Good" in the
Previous month. I thought having the other Criteria, Status="Good"
might
be
causing the issue but now I don't think so. I'm getting more confused.
Thanks
for your assistance.
:
I just tried it and DateAdd("m",-1,Now()) gave me 18th of January and
Month(DateAdd("m", -1, Now())) gave me '1', which is the month number
of
the
previous month.
What result did you get for DateAdd("m",-1,Now())?
--
OK, I tried these two and neither accomplished what I was hoping. Am
I
missing something really simple?
DateAdd("m",-1,Now())
DateAdd("m",-1,Date())
:
Are you recommending using something like "DateAdd("m",-1,Now())"?
Unfortunately that did not work. Maybe I've got something wrong in
there.
I'm
going to give it another shot in the morning. I've got a headache
right
now.
I realize that the previous month and the 90 days seems
inconsistent
and
believe me we've had that conversation and to be honest I agree
with
you.
But
for this purpose they are being treated separately and one does
need
to
be by
days whereas the other needs to be the previous month. I know, I
know.
:
I assume that 'last month' means the month before the current
month.
Use the dateadd function with Now() and the month parameter 'm'
and
numeric
value -1 to get a date in the previous month. Use the month()
function
with
that date to get the month number for the previous month. Use the
month()
function with the date from the data records to get the month
number
for
each record, and compare the two to identify records from last
month.
Note that this result will be inconsistent with the -90 you are
using
for
the other task. You really need to rewrite the archiving
procedure
to
also
use month numbers rather than number of days.
--
I have a table which will contain 90 days worth of entries and
after
90
days
I want the older entries to be appended to a new table. I need
two
Queries
one that will Append the old entries based on the date field
and
the
parameter of 90 days (which I think I have) and then a second
Query
which
will display last months entries (this is the one I'm having
problems
with).
I'm using "<(Now()-90)" for the 90 days Append but I can't seem
to
do
anything with the last month Query. Using 30 days won't work
because
I
don't
know if the Query will be used the first of the month, the 15th
or
the
30th,
regardless it needs to display the last months entries.