View Full Version : Print one record on a form to a report


Skiddon
02-08-2010, 06:26 AM
I am trying to print one single record to a report that I have already created. When I click the button on the form nothing happens. Here is the code I am using. Someone Help!!!

Private Sub Print_Packet_Click()
If Me.Dirty Then 'Save any edits.
Me.Dirty=False
End If
If Me.NewRecord Then 'Check there is a record to print
MsgBox "There is no data for this record. Please select another record."
Else
DoCmd.OpenReport "Report", acViewPreview, , "ID='" & Me.ID & "'"
End If
End Sub

pbaldy
02-08-2010, 07:10 AM
The syntax would be different if the data type of ID is not text:

http://www.baldyweb.com/wherecondition.htm