criteria error when running a report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a function dhCountWorkdays that I use in my query and then run a
report from that query.

My function gives me the workdays between the current date and
[InCheckDate] field. The query runs, but puts an error in the blank field
for my expression. That’s not a problem since no one would ever see the
query.

I have a report that is based on that query and I can’t run the report due
to getting the error message ‘Data type mismatch in the criteria expression’.
How can I get my query or report to ignore the blanks in my [InCheckDate]
field when I use the dhCountWorkdays expression? Is there an IIf statement
that can be used with my current expression?

My expression in my query now is: Expr5:
dhCountWorkdays(Date(),[InCheckDate])
 
Try

IIF(IncheckDate Is Null,0,dhCountWorkdays(Date(),[InCheckDate]))

Which should return 0 if InCheckCate is "blank" or try

\
IIF(InCheckDate Is Null,Null,dhCountWorkdays(Date(),[InCheckDate]))
 
Both below work. You saved me. Thank you very much for responding so quick.
Less than a 24 hour turn around. I'm impressed. Who needs to buy books
when all the answers and more come from all the MVPs. Thanks again.

John Spencer (MVP) said:
Try

IIF(IncheckDate Is Null,0,dhCountWorkdays(Date(),[InCheckDate]))

Which should return 0 if InCheckCate is "blank" or try

\
IIF(InCheckDate Is Null,Null,dhCountWorkdays(Date(),[InCheckDate]))

I have a function dhCountWorkdays that I use in my query and then run a
report from that query.

My function gives me the workdays between the current date and
[InCheckDate] field. The query runs, but puts an error in the blank field
for my expression. That’s not a problem since no one would ever see the
query.

I have a report that is based on that query and I can’t run the report due
to getting the error message ‘Data type mismatch in the criteria expression’.
How can I get my query or report to ignore the blanks in my [InCheckDate]
field when I use the dhCountWorkdays expression? Is there an IIf statement
that can be used with my current expression?

My expression in my query now is: Expr5:
dhCountWorkdays(Date(),[InCheckDate])
 
Back
Top