Solved

How print report using key field on report as criteria for the report

Posted on 2013-05-21
2
369 Views
Last Modified: 2013-05-22
On a form I have several fields and the form has tblMatlsTrans as its record source.  One of the fields is the key field named ID.  Also on the form is a command button that the user will use to print a report of that record but it has to use ID as it's criteria.  What is the onclick code for the command button?
0
Comment
Question by:SteveL13
[X]
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
2 Comments
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 total points
ID: 39185571
something along the lines of:

Docmd.Openreport "reportName", acViewPreview, , "[ID] = " & me.[ID]
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 39188201
<No Points wanted>

On the chance that the ID is textual, use something like this:

Docmd.Openreport "ReportName", acViewPreview, , "[ID] = " & "'" & me.[ID] & "'"

JeffCoachman
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Access insert into query working but takes forever and local table not found 19 45
Save Selections in MS Access 3 31
Microsoft Access 2016 Bug? 9 47
Access #Deleted data 20 44
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
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 …

730 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