#Error

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

I have a query to find total IndirectHours for each worker
and a query to find total DirectHours for each worker. I
created a form with text boxes to display the results for
each worker. I then added a text box to compute each
workers productivity.

This works great as long as a worker has an entry for both
DirectHours and IndirectHours. However, if one or both are
missing I get #Error in the Productivity text box. Is
there a way for the total Direct/IndirectHours to enter a
zero if that worker didn't have an entry? I tried to use
the Default Setting set to 0 but that didn't work.

My form is setup like this:

Text Boxes:
[WorkerID]
[Name]
[txtDirectHours] total hours from query - qryDirectHours
[txtIndirectHours] total hours from query - qryIndirHours
[txtTotalHours] = [txtDirectHours]+[txtIndirectHours]
[txtDirectPerc] from qryWork [DirectPercent] calculated
with this formula: [DirPay]/[DirHours]/[WageBase]
[txtA] = [txtDirectHours]/[txtTotalHours]*[txtDirectPerc]
[txtB] = [txtIndirectHours]/[txtTotalHours]*100
[Productivity] = [txtA]+[txtB]
 
Well, I figured it out with a little research. In the
control souce for each textbox I added Nz at the start of
each expression. Works great!!
 
Back
Top