I defenitely entered the formula into a text box in the report.
However, where I think the problem lies is with the database design. I
inherited this database and am not sure if it was set up the best way.
In actuality the EmployeeStatus field on the report is pulling info from
the
EmployeeStatusCode field in the query. Instead of "Temp" it is code "1",
Regular is "2". Same with the Separation Status, voluntary is "1",
involuntary is "2".
The row source on the EmployeeStatus fields reads like below to display
the
status instead of the code in the query results.
SELECT EmployeeStatus.EmployeeStatusCode, EmployeeStatus.EmployeeStatus
FROM
EmployeeStatus;
Errors:
=Sum(IIf([EmployeeStatus]="Temp",1,0)) Doesn't recognize
EmployeeStatus
or
=Sum(IIf([EmployeeStatusCode]="1",1,0)) The expression is typed
incorrectly, or it is too complex to be evaluated.
HELP!! What am I doing wrong?
John Spencer said:
I've never seen that error message associated with the control source of
a control on a form or report.
Where did you enter the expression? Hopefully not in a query.
'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
Whitney wrote:
It says the expression is too complex.
:
Add a text box for each expression
Set the Control source to = theexpression
Control Name: txtCountTemps
Control Source: =Sum(IIF([employee status] = "Temp",1,0))
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
Whitney wrote:
Where do I put this, in the query or in a text box in the report
header?
:
I believe that Karl made one small error in his example code.
Total Temps: Sum(IIF([employee status] = "Temp",1,0))
Total Regular: Sum(IIF([employee status] = "Regular",1,0))
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
KARL DEWEY wrote:
Total Temps: Sum(IIF([employee status] = "Temp", 0))
Total Regular: Sum(IIF([employee status] = "Regular", 0))
Total Voluntary: Sum(IIF([separation status] = "voluntary", 1, 0))
Total Involuntary: Sum(IIF([separation status] = "involuntary", 1,
0))