Printing a single record

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
 
D

Duane Hookom

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top