Well, first off, you are missing a closing double quote after the question mark in this line:
Code:
If MsgBox("Do you want to print a report?", 4 + 32, "Print Report?") = 6 Then
It is much easier to read (IMO) if you use VBA constants:
Code:
If MsgBox("Do you want to print a report?", vbYesNo + vbQuestion, "Print Report?") = vbYes Then
The on error statement is in the wrong place. it should be the line after
"Private Sub subSubform_Exit(Cancel As Integer)"
Then you have the "ELSE ... END IF" in the wrong place. It should be before the "ExitHere:" label. BTW, putting a colon ( : ) after the "Else" made it a label - shouldn't put a colon after the Else.
The big question is why you set screen updating to FALSE, then open the report in preview mode??? You can't see the preview, so why open it??
Why don't you just do this?
Code:
Private Sub subSubform_Exit(Cancel As Integer)
On Error GoTo ErrorHandler
'To show a Yes/No message box when the user exits the subform to ask if they want to print a report.
If MsgBox("Do you want to print a report?", vbYesNo + vbQuestion, "Print Report?") = vbYes Then
'Enter below what to do if they click 'Yes' (start printing)
'Opens print dialog for current screen (report in this case):
DoCmd.RunCommand acCmdPrint
End If
ExitHere:
Exit Sub
ErrorHandler:
If Err.Number <> 0 And Err.Number <> 2501 Then
MsgBox "Error: " & Err.Number & vbNewLine & Err.Description
End If
Resume ExitHere
End Sub