Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Print Current Record in form to a report

Posted on 1998-01-10
2
Medium Priority
?
451 Views
Last Modified: 2008-03-17
I wish to place a button on my form to print a report of the current record shown on the form.  The main form is from a table and the subform is a query, all works fine, the report is fine.  I currently use a query parameter prompt (dialog box) to ask for the current ID field.  I wish to by-pass this step to simple click a button to first preview the report prior to printing, and/or perhaps a second option to print the report without previewing.

Thanks in advance.
0
Comment
Question by:DWB
2 Comments
 
LVL 5

Accepted Solution

by:
cekman earned 200 total points
ID: 1965103
Let's say the record on your form is for a particular customer with field name CustID. Then - when the user presses the button you do an open report with linkcriteria. For example on the code for the button:

dim LinkCriteria as string

LinkCriteria = "[CustID] = " & me![custID]
docmd.openreport "REPORTNAMEHERE",acPreview,,Linkcriteria

or to go directly to printer:
docmd.openreport "REPORTNAMEHERE",acNormal,,Linkcriteria


Hope this helps
CEkman
0
 

Author Comment

by:DWB
ID: 1965104
Many Thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

885 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