Expression Error

  • Thread starter ladybug via AccessMonster.com
  • Start date
L

ladybug via AccessMonster.com

I have this expression in a query: [CleanOrdersWithin]/([TotalShippedOrders]-
[OrdersReqIntervention])
If CleanOrders Within and Total Shipped Orders both = 0, how do I get the
expression to not error?
 
A

Andy Hull

Hi

To avoid a divide by zero error you only need to check if the divisor is zero.
i.e. [TotalShippedOrders]-[OrdersReqIntervention]

So I would use...

iif([TotalShippedOrders]-[OrdersReqIntervention]=0, 0, [CleanOrdersWithin] /
([TotalShippedOrders] - [OrdersReqIntervention]))


Regards

Andy Hull
 
S

Stefan Hoffmann

hi,
I have this expression in a query: [CleanOrdersWithin]/([TotalShippedOrders]-
[OrdersReqIntervention])
If CleanOrders Within and Total Shipped Orders both = 0, how do I get the
expression to not error?
Use

Iif([TSO]-[ORI]=0; -1; [TSO]-[ORI])

as denominator.



mfG
--> stefan <--
 
M

Marshall Barton

ladybug said:
I have this expression in a query: [CleanOrdersWithin]/([TotalShippedOrders]-
[OrdersReqIntervention])
If CleanOrders Within and Total Shipped Orders both = 0, how do I get the
expression to not error?


IIf([TotalShippedOrders] - [OrdersReqIntervention] = 0, 0,
[CleanOrdersWithin] / ([TotalShippedOrders] -
[OrdersReqIntervention]))
 
Top