Supportnet / Forum / Datenbanken
Ausdruck von Reports
Frage
Hallo zusammen
ich habe 4 verschiedene Reports. Welcher der 4 Reports gedruckt werden muss hängt von der Auswahl einer spezifischen Kategorie ab. Aber irgendwie klappt es nicht so ganz:
Private Sub Print_Click()
On Error GoTo Err_Print_Click
Dim ID As String
ID = "[ID]=" & Me![ID]
If Me!Kategorie = "Kategorie 1" Then
DoCmd.OpenReport "Report 1", , , ID
End If
If Me!Kategorie = "Kategorie 2" Then
DoCmd.OpenReport "Report 3", , , ID
End If
If Me!Kategorie = "Kategorie 3" Then
DoCmd.OpenReport "Report 3", , , ID
End If
If Me!Kategorie = "Kategorie 4" Then
DoCmd.OpenReport "Report 4", , , ID
End If
Exit_Print_Click:
Exit Sub
Err_Print_Click:
MsgBox Err.Description
Resume Exit_Print_Click
End Sub
Antwort 1 von Roadrunner90
und was klappt nicht?
Antwort 2 von achii
sorry, na klar, sollte ich auch beifügen.
Es druckt nicht.
Es druckt nicht.
Antwort 3 von achii
Ich konnte es lösen (lassen):
Private Sub Print_Click()
On Error GoTo Err_Print_Click
Dim ID As String
ID = "[ID]=" & Me![ID]
Select Case Me!Kategorie
Case Is = "Kategorie 1", "Kategorie 2"
DoCmd.OpenReport "Formular 1", , , ID
Case Is = "Kategorie 3", "Kategorie 4"
DoCmd.OpenReport "Formular 2", , , ID
Case Is = "Kategorie 5"
DoCmd.OpenReport "Formular 3", , , ID
End Select
Exit_Print_Click:
Exit Sub
Err_Print_Click:
MsgBox Err.Description
Resume Exit_Print_Click
End Sub
Private Sub Print_Click()
On Error GoTo Err_Print_Click
Dim ID As String
ID = "[ID]=" & Me![ID]
Select Case Me!Kategorie
Case Is = "Kategorie 1", "Kategorie 2"
DoCmd.OpenReport "Formular 1", , , ID
Case Is = "Kategorie 3", "Kategorie 4"
DoCmd.OpenReport "Formular 2", , , ID
Case Is = "Kategorie 5"
DoCmd.OpenReport "Formular 3", , , ID
End Select
Exit_Print_Click:
Exit Sub
Err_Print_Click:
MsgBox Err.Description
Resume Exit_Print_Click
End Sub

