T
ToniS
I have a report with three sub reports on it.
As soon as I add the following code I get the following error when I run the
report more then once...(first time the report runs) "Application defined or
object defined error"
If IsNull(Report_ExhReportAlpha_SubReportRepGroups.RepGroupName) Then
blnRepGroup = True
Else
blnRepGroup = False
End If
as soon as I comment out the above the report runs.
Below is all of the source code for the report.
Option Compare Database
Option Explicit
Private Sub Report_Open(Cancel As Integer)
Dim subRptPersons As Report
Dim subRptRepGroups As Report
'set recordsource for rep persons subReport
strSQL = "SELECT EPS.ShowID, EP.ExhibitorID, EP.FirstName, EP.LastName "
& _
"FROM ExhibitorPersonsShows EPS " & _
"INNER JOIN ExhibitorPersons EP ON EPS.ExhibitorPersonID =
EP.ExhibitorPersonID " & _
"Where EPS.ShowID = " & "'" & pubShowID & "'"
DoCmd.OpenReport "ExhReportAlpha_SubReportRepPersons", acViewDesign
Set subRptPersons = Reports!ExhReportAlpha_SubReportRepPersons
subRptPersons.RecordSource = strSQL
DoCmd.Close acReport, "ExhReportAlpha_SubReportRepPersons", acSaveYes
'set recordsource for rep Group subReport
strSQL = "SELECT ExhibitorShowID, RepGroupName, RepresentedID, ShowId "
& _
"FROM ViewAllRepGroups " & _
"Where ShowID = " & "'" & pubShowID & "'"
DoCmd.OpenReport "ExhReportAlpha_SubReportRepGroups", acViewDesign
Set subRptRepGroups = Reports!ExhReportAlpha_SubReportRepGroups
subRptRepGroups.RecordSource = strSQL
DoCmd.Close acReport, "ExhReportAlpha_SubReportRepGroups", acSaveYes
' set Main report Recordsource
strSQL = "SELECT ..... "WHERE (EA.AddressType = 1 and ES.ShowID = " &
"'" & pubShowID & "') ORDER BY E.ExhibitorName "
Report_ExhReportAlpha.RecordSource = strSQL
End Sub
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim blnIntegrityChecking As Boolean
Dim blnRepGroup As Boolean
' temp testing purposes
blnIntegrityChecking = True
If blnIntegrityChecking Then
If IsNull(Report_ExhReportAlpha_SubReportRepGroups.RepGroupName) Then
blnRepGroup = True
Else
blnRepGroup = False
End If
' if missing important info print detail section in grey
If (IsNull(Address1) Or IsNull(City) Or IsNull(State) Or
IsNull(Zipcode)) Or (IsNull(ProductDescription) And blnRepGroup = False) Then
Detail.BackColor = CONST_GREY
Else
Detail.BackColor = CONST_WHITE
End If
End If
End Sub
Any help will be greatly appreciated.
Tonis
As soon as I add the following code I get the following error when I run the
report more then once...(first time the report runs) "Application defined or
object defined error"
If IsNull(Report_ExhReportAlpha_SubReportRepGroups.RepGroupName) Then
blnRepGroup = True
Else
blnRepGroup = False
End If
as soon as I comment out the above the report runs.
Below is all of the source code for the report.
Option Compare Database
Option Explicit
Private Sub Report_Open(Cancel As Integer)
Dim subRptPersons As Report
Dim subRptRepGroups As Report
'set recordsource for rep persons subReport
strSQL = "SELECT EPS.ShowID, EP.ExhibitorID, EP.FirstName, EP.LastName "
& _
"FROM ExhibitorPersonsShows EPS " & _
"INNER JOIN ExhibitorPersons EP ON EPS.ExhibitorPersonID =
EP.ExhibitorPersonID " & _
"Where EPS.ShowID = " & "'" & pubShowID & "'"
DoCmd.OpenReport "ExhReportAlpha_SubReportRepPersons", acViewDesign
Set subRptPersons = Reports!ExhReportAlpha_SubReportRepPersons
subRptPersons.RecordSource = strSQL
DoCmd.Close acReport, "ExhReportAlpha_SubReportRepPersons", acSaveYes
'set recordsource for rep Group subReport
strSQL = "SELECT ExhibitorShowID, RepGroupName, RepresentedID, ShowId "
& _
"FROM ViewAllRepGroups " & _
"Where ShowID = " & "'" & pubShowID & "'"
DoCmd.OpenReport "ExhReportAlpha_SubReportRepGroups", acViewDesign
Set subRptRepGroups = Reports!ExhReportAlpha_SubReportRepGroups
subRptRepGroups.RecordSource = strSQL
DoCmd.Close acReport, "ExhReportAlpha_SubReportRepGroups", acSaveYes
' set Main report Recordsource
strSQL = "SELECT ..... "WHERE (EA.AddressType = 1 and ES.ShowID = " &
"'" & pubShowID & "') ORDER BY E.ExhibitorName "
Report_ExhReportAlpha.RecordSource = strSQL
End Sub
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim blnIntegrityChecking As Boolean
Dim blnRepGroup As Boolean
' temp testing purposes
blnIntegrityChecking = True
If blnIntegrityChecking Then
If IsNull(Report_ExhReportAlpha_SubReportRepGroups.RepGroupName) Then
blnRepGroup = True
Else
blnRepGroup = False
End If
' if missing important info print detail section in grey
If (IsNull(Address1) Or IsNull(City) Or IsNull(State) Or
IsNull(Zipcode)) Or (IsNull(ProductDescription) And blnRepGroup = False) Then
Detail.BackColor = CONST_GREY
Else
Detail.BackColor = CONST_WHITE
End If
End If
End Sub
Any help will be greatly appreciated.
Tonis