Solved

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

Posted on 2013-05-21
2
372 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 48

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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
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 different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

717 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