David, here's all the code for the report - 'Bericht' means Report, fuss = footer, kopf = header
Option Compare Database
Option Explicit
Dim dblSollPPDNR, dblSollDIN, dblSollTRB, dblSollAll As Double
Dim boolHasAdded As Boolean
Dim i As Integer
Private Sub Berichtskopf_Format(Cancel As Integer, FormatCount As Integer)
txtAllSoll = 0#
End Sub
Private Sub Berichtsfuß_Format(Cancel As Integer, FormatCount As Integer)
txtAllSoll = dblSollAll
End Sub
Private Sub headTRB_Format(Cancel As Integer, FormatCount As Integer)
dblSollTRB = 0#
End Sub
Private Sub footTRB_Format(Cancel As Integer, FormatCount As Integer)
txtTRB_Printed = dblSollTRB
End Sub
'DIN - funktionsbereich
Private Sub headDIN_Format(Cancel As Integer, FormatCount As Integer)
dblSollDIN = 0#
End Sub
Private Sub footDIN_Format(Cancel As Integer, FormatCount As Integer)
txtDIN_Printed = dblSollDIN
End Sub
'PPDNR
Private Sub headPPDNR_Format(Cancel As Integer, FormatCount As Integer)
dblSollPPDNR = 0#
boolHasAdded = False
End Sub
Private Sub footPPDNR_Format(Cancel As Integer, FormatCount As Integer)
txtPPDNR_Printed = dblSollPPDNR
If IsNull(txtRoomCount) Then
txtFunction = [Funktion]
Else
txtFunction = [Funktion] & " Gesamt: "
End If
If boolHasAdded = False Then
dblSollDIN = dblSollDIN + dblSollPPDNR
dblSollTRB = dblSollTRB + dblSollPPDNR
dblSollAll = dblSollAll + dblSollPPDNR
boolHasAdded = True 'need this as on page change this event fires twice`?
'Debug.Print txtBezeichnung & " " & dblSollPPDNR
'Debug.Print Text60
End If
End Sub
Private Sub Detailbereich_Format(Cancel As Integer, FormatCount As Integer)
If dblSollPPDNR = 0 Then
dblSollPPDNR = txtPPDSoll
End If
If IsNull(txtRoomCount) Then
Cancel = True
End If
End Sub