I have two reports which are very similar, so it will make sense to make it one report, and just insert a different header.
I have declared a variable "Header" when calling the Report:
Private Sub Befehl22_Click()
Dim stDocName As String
Dim Header As String
Header = "Header for Transatlantic"
stDocName = "Openorders"
DoCmd.OpenReport stDocName, acPreview, , "[Ausblenden]=False AND [Shipped] ='Nein' AND [Bestellnummer-D]Not Like 0 AND [Anfragende Firma] Like'Transatlantic*'"
Exit_Befehl122_Click:
Exit Sub
End Sub
In my report I have created a text Field TEXT1000.
And in the header section I have an Onformat VBA like that:
Private Sub Berichtskopf_Format(Cancel As Integer, FormatCount As Integer)
'Me.[Text1000] = "Header"
End Sub
It would be nice if somebody could assist me to make this work.
Rainer