Thanks for the quick response.
It doesn't work.
The whole command is on the report button:
Private Sub PRINT2_Click()
On Error GoTo Err_PRINT2_Click
Dim msgResult As VbMsgBoxResult 'Boolean
msgResult = MsgBox "are u sure u want to save?", vbYesNo, "Important!")
If msgResult = vbNo Then
DoCmd.CLOSE acForm, Me.NAME
Exit Sub
End If
If msgResult = vbYes Then
Dim stDocName As String
stDocName = "frm_copies"
DoCmd.OPENFORM stDocName, acNormal
Me.STATUS = "closed"
Me.IS_PRINTED = True
[INVOICE_NO] = Nz(DMax("[INVOICE_NO]", "TBL_INVOICE") + 1)
DoCmd.RunCommand acCmdSaveRecord (what u suggested and I added)
stDocName = "RPT_INVOICE"
DoCmd.OpenReport stDocName, acNormal
Exit_PRINT2_Click:
Exit Sub
Err_PRINT2_Click:
MsgBox Err.Description
Resume Exit_PRINT2_Click
End If
End Sub
What's wrong?