Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Problem 1

Status
Not open for further replies.

desmur

MIS
Dec 16, 2002
26
0
0
US
I am trying to do a simple calculation in a query. it is dividing one field by another to come up with a rate. When I do that I get a message box that says "This expression is typed incorrectly, or is too complex to be evaluated. For example and numeric expression may contain too many complicated elements. Try simplifying the expressiong by assigning parts of the expressiong to variables." Why would I get that message on a simple expession? I tried to enter in sql and directly in the query. What am I doing wrong?
 
SELECT qrytotalhours.emp_last, qrytotalhours.emp_first, tblClient.client_name, [emp_first] & " " & [emp_last] AS employee, tblTimeSheet.ts_emp_id, tblSalary.emp_brate, tblTimeSheet.ts_pay_dte, qrytotalhours.SumOfts_hrs, tblTimeSheet.ts_hrs, IIf([exp_amount] Is Null,0,[exp_amount]) AS Expenses, tblBillExpense.exp_amount, tblSalary.current, ([emp_prate]/[emp_brate]) AS currentrate
FROM tblClient INNER JOIN ((tblSalary INNER JOIN (tblTimeSheet LEFT JOIN tblBillExpense ON tblTimeSheet.ts_id = tblBillExpense.exp_ts_id) ON (tblSalary.emp_id = tblTimeSheet.ts_emp_id) AND (tblSalary.emp_client = tblTimeSheet.ts_client_id)) INNER JOIN qrytotalhours ON tblTimeSheet.ts_emp_id = qrytotalhours.emp_id) ON tblClient.client_id = tblTimeSheet.ts_client_id
GROUP BY qrytotalhours.emp_last, qrytotalhours.emp_first, tblClient.client_name, [emp_first] & " " & [emp_last], tblTimeSheet.ts_emp_id, tblSalary.emp_brate, tblTimeSheet.ts_pay_dte, qrytotalhours.SumOfts_hrs, tblTimeSheet.ts_hrs, IIf([exp_amount] Is Null,0,[exp_amount]), tblBillExpense.exp_amount, tblSalary.current, qrytotalhours.emp_last, ([emp_prate]/[emp_brate])
HAVING (((tblTimeSheet.ts_pay_dte)=[enter pay date]) AND ((tblSalary.current)=Yes))
ORDER BY qrytotalhours.emp_last;
 
Is there any place in your query where a 'division by zero' or 'division by Null fields' can occur? If so, exclude these rows from the query and see what happens.

Cheers,
Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top