Link to home
Start Free TrialLog in
Avatar of Annu
AnnuFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Test for no-value in control

I have a report with 2 sub-reports. The report is a customer statement between 2 dates showing his/her orders and payments.

One sub-report shows all orders between the 2 dates, and the other sub-report shows all payments between the 2 dates. On each sub-report there is a non-visible control which is the sum of orders (or payments).

This non-visible control is used to supply the total orders and payments values to controls on the main report.
The controls on the main report have control source as:
=[sbrOrders].Report![txtSumOrders] and
=[sbrPayments].Report![txtSumPayments].

[sbrOrders] and [sbrPayments] are the names of the 2 sub-reports. [txtSumOrders] and [txtSumPayments] are the non-visible controls.

A problem occurs when there are no orders (or payments) between the 2 dates. There is no value in the total control on the main report, not even Null.

How do I test for this situation so that I can run alternative code?

Thanks.
Avatar of Al_a_Ddin
Al_a_Ddin

You may use this:
=iif(isnull([sbrOrders].Report![txtSumOrders])=true;0;=[sbrOrders].Report![txtSumOrders])
or like this
=iif(isnumeric([sbrOrders].Report![txtSumOrders])=true;0;=[sbrOrders].Report![txtSumOrders])
Opps..
=iif(isnull([sbrOrders].Report![txtSumOrders])=true;0;[sbrOrders].Report![txtSumOrders])
and
=iif(isnumeric([sbrOrders].Report![txtSumOrders])=true;0;[sbrOrders].Report![txtSumOrders])
Or use something like

  If nz(sbrOrders.Value) > 0 Then
    Process
  Else
    Nothing there
  End if
Have you tried the 'On No Data' evnt in the Report?
ASKER CERTIFIED SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial