I want to create a button on a form in Access 2010 that, when clicked, prints the current record/view of a form. I have tried various VBA scripts. Some print all records, others print partial parts of the form, but not the whole form.

If I hit Ctrl-P, then select "Selected Records", then click OK, it prints the current record/view of the form just fine.

What code can I put in the On Click event prodecure to do the same thing as Ctrl-P, "Selected Records", and "OK" without the user having to do all that?


I found the answer. I saved the form as a report, then I created a button on the form that has this for its code:

Dim strReportname As String
Dim strCriteria As String

strReportname = "ReportfrmClients"
strCriteria = "[ClientID] = " & Me!ClientID

DoCmd.OpenReport strReportname, acNormal, , strCriteria

That sends the report directly to the print queue without opening it. And it only sends one ClientID to the report, so the report only prints the one record.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.