Thank you for the response.
I'm still having trouble. I want it to print the reports based off of the
current record. I guess I should have included that tidbit. It's giving me
a compile error. "Block if without End if"
Here is the code I am using:
Private Sub Cmdprint_Enter()
Dim strWhere As String
If Me.Dirty Then 'save any edits.
Me.Dirty = False
End If
If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[Employee #]=" & Me.[Employee #]
DoCmd.OpenReport "FMLA Leave Request", acViewPreview, , strWhere
DoCmd.OpenReport "Pt 1-leave request", acViewPreview, , strWhere
If Me.[Serious Health Condition] = -1 Then
DoCmd.OpenReport "Medical Clearance Form", acViewPreview, , strWhere
End If
End Sub
*** snipped ***
Do you want it to print the reports or preview the reports?
You are having it preview, so I'll do that also.
You had an If Then Else in your code, then you added my If Then Else
code without adding a closing End If. If you get into the habit of
indenting your code (as I have done below) within the If .. End If's
you will find it easier to debug if you get a Block If without End If
error.
Try it like this to preview all the reports:
Private Sub Cmdprint_Enter()
Dim strWhere As String
If Me.Dirty Then 'save any edits.
Me.Dirty = False
End If
If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[Employee #]=" & Me.[Employee #]
DoCmd.OpenReport "FMLA Leave Request", acViewPreview, , strWhere
DoCmd.OpenReport "Pt 1-leave request", acViewPreview, , strWhere
If Me.[Serious Health Condition] = -1 Then
DoCmd.OpenReport "Medical Clearance Form", acViewPreview, ,
strWhere
End If
End If
End Sub