Print the current record

Posted on 1998-08-27
Medium Priority
Last Modified: 2006-11-17
  Dear Expert,
I made a form where you view the records from a table. I also made a button at the form footer using the command button wizard to print that record. But when I run it instead of printing the current record(through a Report) it keeps printing all the records sequentially. How can I make that button to print only the record fields I am viewing?
               Thanks again
Question by:gsazeides
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 1960444
check the code behind the button. It sounds like you need a where clause in there (e.g. "Where recordID=" & me.recordID)

Expert Comment

ID: 1960445
The fourth argument to DoCmd.OpenReport allows you to specify a WHERE condition. The third argument allows specifying a filter. If you have the form selecting only some records, you obviously already know or can find out how the records are filtered or selected. Just put the appropriate

DoCmd.OpenReport "MyReport", acViewNormal, , "(Customer=5) AND (Payment>5.00)"

If you need more specifics, please supply the fields in the form, and how you select the fields to view.

Accepted Solution

sanctified earned 0 total points
ID: 1960446
Your answer (2 possibilities)

Using a function:

This function will put a message box up asking for what specific page you want to print:

Function PrintPage (reportname As String) As Integer
a = InputBox("Select Page to Print")
 DoCmd Echo False
 DoCmd OpenReport reportname, A_DESIGN
 DoCmd Print A_PAGES, a, a

 DoCmd SetWarnings False
 DoCmd Close A_REPORT, reportname
 DoCmd SetWarnings True
 DoCmd Echo True

 Exit Function

 DoCmd Echo True ' restore screen echo
 Resume ttp_exit

End Function

Using a macro:



This command will bring you to a print window allowing you to choose all pages, you current selection or specified pages.


Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question