chuckcoleman
Registered User.
- Local time
- Today, 14:08
- Joined
- Aug 20, 2010
- Messages
- 377
Hi, I have a report that has a sub report and that sub report has another sub report. I have in the last sub report in the On Load property the following code. Also, in the Record Source property in the Data tab of the last sub report I have that as blank, nothing is there. When I test the code it by doing a print preview it returns no records. I would have thought the On Load property would run the code below. What am I doing wrong?
Code:
Private Sub Report_Load()
Dim rpt As Report
Dim strSQL As String
If CurrentProject.AllForms("Re-Invoice Form").IsLoaded Then
strSQL = "Select * From [Balance Due-Report-Paid-3-Reinvoice];"
Else
strSQL = "Select * From [Balance Due-Report-Paid-3];"
End If
Set rpt = CreateReport
rpt.RecordSource = strSQL
Set rpt = Nothing
End Sub