Print Button on Form

  • Thread starter Thread starter Marilee
  • Start date Start date
M

Marilee

I have a frustrating problem and need some advice. I have
a form that users complete and have a print button that
links to the appropriate report. The problem is that
sometimes when the user hits the print button, it doesn't
print the report properly (missing info). When I exit and
then go back in, it prints fine. What code do I use on
the print button so that the record updates before
printing?
 
You need to save the record before you can print it.

Something like this:

Private Sub cmdPrintRecord_Click()
If Me.Dirty Then
Me.Dirty = False
End If
If Me.NewRecord Then
MsgBox "Select a record to print."
Else
DoCmd.OpenReport "MyReport", acViewPreview, , "ID = " & Me.[ID]
End If
End Sub
 
Back
Top