Can #Error not be displayed

  • Thread starter Thread starter TK
  • Start date Start date
T

TK

Hi:
I have a report with two subreports. A value from each
subreport is displayed on the main report. All is well if
there is a value in the subreports textbox. If not #Error
is displayed in the textboxes on the main report that
derive their value from the subreport. How can I clear
the #Error from the main reports textbox.. I have tried
IIf but can't read the textbox if no value is present.

Thanks TK
 
Read the HasData property of the report in the subreport control:

=IIf([MySub].[Report].[HasData], Nz([MySub].[Report].[MyTextBox], 0), 0)
 
Thanks for your help Allen

I'm still just wandering around in the dark here. I tried
putting the "IIF" in both the sub-report and the main
report with no success. If you would indulge me with a
little more of your time I going to be a little more
specific.

One of the two sub-reports are as follows.
A recordset is generated in VB and inserted in an Access
table.
All records if any are then presented in the detail
section of the sub-report at run time. All works
according to plan if there are records, if not #Error is
presented in the main report.

Sub-Report name = TmpPrtOrd
Fields = Qty, Rate, ExtPrice (and Text19 generated in
the sub-report)
Text19 is set to visible = no
The Control Source =([ExtPrice]} (running sum over group)

Report name = Invoice
#Error Textbox = Text16 and it is in the page footer of
the report.
Control Source =[TmpPrtOrd]![Text19]
I'm not sure if I'm writing the IIF correctly or if I'm
putting it in the right report. I assume it is the
Control Source for one of the texboxes.

Thanks again.
TK


-----Original Message-----
Read the HasData property of the report in the subreport control:

=IIf([MySub].[Report].[HasData], Nz([MySub].[Report]. [MyTextBox], 0), 0)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Hi:
I have a report with two subreports. A value from each
subreport is displayed on the main report. All is well if
there is a value in the subreports textbox. If not #Error
is displayed in the textboxes on the main report that
derive their value from the subreport. How can I clear
the #Error from the main reports textbox.. I have tried
IIf but can't read the textbox if no value is present.

Thanks TK


.
 
Allen:
Moved Text16 into the Report Footer of the subreport.
=NZ([Text16],0)
It now returns 0 as expected if no data present,
however; attempting to refer to text16 in the main report
with the following still returns #Error.

=NZ([TmpLabOrd]![Text16],0)
=IIf([MySub].[TmpLabOrd].[HasData], Nz([MySub].
[TmpLabbOrd].[Text16], 0), 0)
=IIf([Report].[TmpLabOrd].[HasData], Nz([Report].
[TmpLabOrd].[Text16], 0), 0)

Is it possible that if no information is available text16
is never created in the main report and I'm attempting to
refer to an object that does not exist?

TK
 
Good: you have the first issue solved.

Presumably TmpLabOrd is the name of the subreport control?
Use the ".Report" property to refer to the report in the control:

=IIf([TmpLabOrd].[Report].[HasData], [TmpLabOrd].[Report]![Text16], 0)
 
Allen:
Success at last, thank you.
These things can be a nightmare at times. I'm a pretty
good VB programmer but not much in the office products. I
usually use the VB data report but no sub-reports. The
procedures you just walked me through or actually wrote
does seem a bit complex however for a program that is
supposed to be used in a non programming environment.
Brings to mind the saying "what were they thinking"
Thanks again.
TK
-----Original Message-----
Good: you have the first issue solved.

Presumably TmpLabOrd is the name of the subreport control?
Use the ".Report" property to refer to the report in the control:

=IIf([TmpLabOrd].[Report].[HasData], [TmpLabOrd]. [Report]![Text16], 0)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Allen:
Moved Text16 into the Report Footer of the subreport.
=NZ([Text16],0)
It now returns 0 as expected if no data present,
however; attempting to refer to text16 in the main report
with the following still returns #Error.

=NZ([TmpLabOrd]![Text16],0)
=IIf([MySub].[TmpLabOrd].[HasData], Nz([MySub].
[TmpLabbOrd].[Text16], 0), 0)
=IIf([Report].[TmpLabOrd].[HasData], Nz([Report].
[TmpLabOrd].[Text16], 0), 0)

Is it possible that if no information is available text16
is never created in the main report and I'm attempting to
refer to an object that does not exist?


.
 
Fair enough.

The distinction between the subreport control and the report contained in
that control is an important one.

To help clarify, the subreport control has properties such as
LinkMasterFields and LinkChildFields which define which field(s) on the main
report map to which field(s) in the subreport. It also has a SourceObject
property which indicates the name of the report it contains.

The report *in* the subreport control has properties such as a RecordSource,
a Detail section, etc.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.
TK said:
Allen:
Success at last, thank you.
These things can be a nightmare at times. I'm a pretty
good VB programmer but not much in the office products. I
usually use the VB data report but no sub-reports. The
procedures you just walked me through or actually wrote
does seem a bit complex however for a program that is
supposed to be used in a non programming environment.
Brings to mind the saying "what were they thinking"
Thanks again.
TK
-----Original Message-----
Good: you have the first issue solved.

Presumably TmpLabOrd is the name of the subreport control?
Use the ".Report" property to refer to the report in the control:

=IIf([TmpLabOrd].[Report].[HasData], [TmpLabOrd]. [Report]![Text16], 0)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Allen:
Moved Text16 into the Report Footer of the subreport.
=NZ([Text16],0)
It now returns 0 as expected if no data present,
however; attempting to refer to text16 in the main report
with the following still returns #Error.

=NZ([TmpLabOrd]![Text16],0)
=IIf([MySub].[TmpLabOrd].[HasData], Nz([MySub].
[TmpLabbOrd].[Text16], 0), 0)
=IIf([Report].[TmpLabOrd].[HasData], Nz([Report].
[TmpLabOrd].[Text16], 0), 0)

Is it possible that if no information is available text16
is never created in the main report and I'm attempting to
refer to an object that does not exist?


.
 
Back
Top