Printing a single record

  • Thread starter Thread starter RW Brown
  • Start date Start date
R

RW Brown

I am trying to print a single record form a command button
on the form. Everytime a try, I get all the records
printing out. How can I accomplish a single record
printout on a report? The form is called dimserv and the
report is called repairticket.

Thanks

Roger
 
Do you know which record you want to print? Assuming it is the one currently
displayed on the form and it has a numeric primary key field of ID.

Dim strWhere as String
strWhere = "ID= " & Me.ID
DoCmd.OpenReport "RepairTicket", acViewPreview, , strWhere

If your primary key field is text:
strWhere = "ID= """ & Me.ID & """"
_____________
Duane Hookom
MS Access MVP

DoCmd.OpenReport "RepairTicket", acViewPreview, , strWhere
 
Back
Top