Hi! I have created a subreport that shows the heading only on change of a type field. This subreport works fine when I run it on its own. However, when it runs as part of the main report, I am losing the last record in the subreport. When I put test messages in the logic that does the hiding/displaying of the header section, I can see the last record is there. I can't figure out why it is not displaying. The data source is a query sorted by a sequence number. The query data also looks fine.
Here's the logic on format of the header section:
Option Compare Database
Dim lastquestiontype As String
Private Sub GroupHeader2_Format(Cancel As Integer, FormatCount As Integer)
MsgBox lastquestiontype & " " & Me.QuestionType & " " & Me.QuestionDesc & " " & Me.QuestionResponse
'ck question type of each record coming in so can display header only on change of type
If lastquestiontype <> Me.QuestionType Then
' MsgBox "true"
Me.GroupHeader2.Visible = True
Else
' MsgBox "false"
Me.GroupHeader2.Visible = False
End If
lastquestiontype = Me.QuestionType
End Sub
For example, I have 4 records. Two have type Blue and two have type Red. I should see:
blue
rec 1
rec 2
red
rec 3
rec 4
But I am not seeing rec 4 even though my test messages show red and the rec 4 data before ending.
Does anyone have any ideas? I must be missing something obvious.
Thanks,
Alexis
Here's the logic on format of the header section:
Option Compare Database
Dim lastquestiontype As String
Private Sub GroupHeader2_Format(Cancel As Integer, FormatCount As Integer)
MsgBox lastquestiontype & " " & Me.QuestionType & " " & Me.QuestionDesc & " " & Me.QuestionResponse
'ck question type of each record coming in so can display header only on change of type
If lastquestiontype <> Me.QuestionType Then
' MsgBox "true"
Me.GroupHeader2.Visible = True
Else
' MsgBox "false"
Me.GroupHeader2.Visible = False
End If
lastquestiontype = Me.QuestionType
End Sub
For example, I have 4 records. Two have type Blue and two have type Red. I should see:
blue
rec 1
rec 2
red
rec 3
rec 4
But I am not seeing rec 4 even though my test messages show red and the rec 4 data before ending.
Does anyone have any ideas? I must be missing something obvious.
Thanks,
Alexis