I have a report in MS Access 2010. If I run the report using the view Icon the Group Header displays but all other fields are blank. If I run it in Print Preview All fields display as their supposed to with 1 exception. This is a 2 page report and the first record of the second page displays all 0's for the data elements even though the query shows there are numbers there.
Here's the VBA behind the report. Anybody see anything I'm missing. I stepped through the code and it looks like it's working correctly however when it goes to a new page all of the variables are reset to 0 and I don't understand why.
Code:
Option Compare Database
Option Explicit
Private lngsRaUTHS As Long
Private lngCommercialAuths As Long
Private lngSrmbrship As Long
Private lngCommmbrship As Long
Private lngGTSRauths As Long
Private lngGTcommercialauths As Long
Private lngGTsrmbrship As Long
Private lngGTcommmbrship As Long
Private tpdays As Long
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Select Case Me.LOB
Case Is = "SENIOR"
If Me.STATUS = 1 Then
lngSrmbrship = lngSrmbrship + Me.mbrmonths
lngsRaUTHS = lngsRaUTHS + Me.AUTHS
lngGTsrmbrship = lngGTsrmbrship + Me.mbrmonths
lngGTSRauths = lngGTSRauths + Me.AUTHS
End If
Case Is = "COMMERCIAL", Is = "COMM-POS"
If Me.STATUS = 1 Then
lngCommmbrship = lngCommmbrship + Me.mbrmonths
lngCommercialAuths = lngCommercialAuths + Me.AUTHS
lngGTcommmbrship = lngGTcommmbrship + Me.mbrmonths
lngGTcommercialauths = lngGTcommercialauths + Me.AUTHS
End If
End Select
End Sub
Private Sub GroupFooter1_Format(Cancel As Integer, FormatCount As Integer)
Me.txtsRaUTHS = lngsRaUTHS
Me.txtcommauths = lngCommercialAuths
Me.txtsrmbrship = lngSrmbrship
Me.txtcommmbrship = lngCommmbrship
If lngSrmbrship = 0 Then
Me.txtsrper1000 = 0
Me.txtsrauthpermbr = 0
Else
Me.txtsrper1000 = (lngsRaUTHS / lngSrmbrship) * (365 / tpdays) * 1000
Me.txtsrauthpermbr = (lngsRaUTHS / lngSrmbrship) * (365 / tpdays)
End If
If lngCommmbrship = 0 Then
Me.txtcommper1000 = 0
Me.txtcommauthpermbr = 0
Else
Me.txtcommper1000 = (lngCommercialAuths / lngCommmbrship) * (365 / tpdays) * 1000
Me.txtcommauthpermbr = (lngCommercialAuths / lngCommmbrship) * (365 / tpdays)
End If
Me.txttotauths = lngsRaUTHS + lngCommercialAuths
Me.txttotmbrs = lngSrmbrship + lngCommmbrship
If Me.txttotmbrs = 0 Then
Me.txttotauthsper1000 = 0
Me.txttotauthspermbr = 0
Else
Me.txttotauthsper1000 = (Me.txttotauths / Me.txttotmbrs) * (365 / tpdays) * 1000
Me.txttotauthspermbr = (Me.txttotauths / Me.txttotmbrs) * (365 / tpdays)
End If
lngCommmbrship = 0
lngSrmbrship = 0
lngsRaUTHS = 0
lngCommercialAuths = 0
End Sub
Private Sub Report_Load()
tpdays = DateDiff("d", Forms!form1!txtstart, Forms!form1!txtend) + 1
End Sub
Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
Me.txtGTSrAuths = lngGTSRauths
Me.txtGTsrmbrs = lngGTsrmbrship
Me.txtgtsrauthsper1000 = (lngGTSRauths / lngGTsrmbrship) * (365 / tpdays) * 1000
Me.txtgtsrauthspermember = (lngGTSRauths / lngGTsrmbrship) * (365 / tpdays)
Me.txtGTcommauths = lngGTcommercialauths
Me.txtGTCommmbrs = lngGTcommmbrship
Me.txtgtcommauthsper1000 = (lngGTcommercialauths / lngGTcommmbrship) * (365 / tpdays) * 1000
Me.txtgtcommauthspermbr = (lngGTcommercialauths / lngGTcommmbrship) * (365 / tpdays)
Me.txtgtauths = lngGTSRauths + lngGTcommercialauths
Me.txtgtmbrs = lngGTsrmbrship + lngGTcommmbrship
Me.txtgtautsper1000 = (Me.txtgtauths / Me.txtgtmbrs) * (365 / tpdays) * 1000
Me.txtGTtotauthspermbrs = (Me.txtgtauths / Me.txtgtmbrs) * (365 / tpdays)
End Sub