#error in main report textbox when in report view (1 Viewer)

acs

New member
Local time
Tomorrow, 00:55
Joined
May 18, 2020
Messages
7
There is a textbox that uses iif(sub.report.hasdata,sub.report.value,0) expression in the main report (main) to retrieve calculated field data in the subreport (sub). The sub has another 4 subreport. When in report/print view, #error shows in the main textbox. In layout view, when the sub is selected, the correct value shows up in the main textbox.
The sub when open on its own works just fine.

I suspect the sub is taking too long to load but the main textbox loads faster and is unable to retrieve data from the sub textbox.

Things tried:
-under properties tab in the sub, in timeinterval field 0 was changed to 1000 but the main textbox value show 0 which is wrong.
-removing expression from main report textbox, under properties, on load event, add in code expression
Private Sub Report_Load()
If Me.sub.Report.HasData Then
Me.main textbox.Value = Me.sub.Report!sub textbox
Else Me.main textbox.Value = 0
End If
End Sub
>> result show 0

how to get main textbox to show the correct value and print/save without selecting sub in layout view?
 

bob fitz

AWF VIP
Local time
Today, 17:55
Joined
May 23, 2011
Messages
4,727
Try your code in the OnPrint or OnFormat events of the report section that has the text box
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 12:55
Joined
Feb 19, 2002
Messages
43,275
Report view doesn't include any breaking logic so those sections will not calculate in that view. Does the report work correctly in PrintPreview?
 

acs

New member
Local time
Tomorrow, 00:55
Joined
May 18, 2020
Messages
7
Try your code in the OnPrint or OnFormat events of the report section that has the text box
there isnt OnPrint or OnFormat events in the property sheet. thanks for the reply. i tried opening the subreport then open the main report, and the value appears correctly
 

acs

New member
Local time
Tomorrow, 00:55
Joined
May 18, 2020
Messages
7
Report view doesn't include any breaking logic so those sections will not calculate in that view. Does the report work correctly in PrintPreview?
nope it doesnt. thanks for the reply. i tried opening the subreport then open the main report, and the value appears correctly
 

Users who are viewing this thread

Top Bottom