Date Records

D

Doug Wilson

I am trying to build a query to use in creating a report. The records in my
table (tblLiftStation) contain daily entries in two fields ([Meter1] and
[Meter2]) of hour meters connected to electric motors along with an
inspection date ([InspDate]) field. A report would be printed each month
based on the daily records entered during the previous month. I can query
for the daily entries for the previous month using the criteria
Month([Inspdate])=Month(Now())-1 And Year([Inspdate])=Year(Now())
for all months except for December. In that case, the statement
Month([Inspdate])=12 And Year([Inspdate])=Year(Now())-1
filters for the records I need.
I was attempting to build an IIF statement that would combine the two,
basing it on an expression of
Month(Now())=1
then using the
Month([Inspdate])=12 And Year([Inspdate])=Year(Now())-1
as the <truepart> to return the monthly entries for the month of December of
the previous year, and using the
Month([Inspdate])=Month(Now())-1 And Year([Inspdate])=Year(Now())
as the <falsepart> to return the monthly entries for all other months.
The combined statement always returns no records.
 
M

[MVP] S.Clark

That means that your criteria is evaluating to a value that does not match
any of the records in the table. Try recreating the criteria, one small
piece at a time, until you determine what the cause of the exclusion is.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top