Summing a field (expression from Query) on a report

G

Guest

I am new to creating expressions in a query. This is the expression that I
have created to yield the number of hours an employee has taken in a given
period and if no hours have been taken the field is blank. I want to be
able to sum this field on a report. The expression works in my query but I
can not sum it in a report. I get a date type mismatch in criteria
expression error. Here is the expression-- Hrs 1st 90 days: IIf([New
Hire?]="NO"," ",IIf([Date_Comp] Between ([CurrentHireDate]-30) And
([CurrentHireDate]+90),[Act_Hrs],0)). Could the problem be the blank left if
the person is not a new hire?
 
D

Duane Hookom

You should avoid having If-True and If-False values in an IIf() that return
different data types. Try replace your " " with either 0 or Null. Check to
see if the field aligns left or right in the datasheet view. If it left
aligns, wrap your entire expression in Val(.....)
 

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