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

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?
SteveL13Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Dale FyeConnect With a Mentor Commented:
something along the lines of:

Docmd.Openreport "reportName", acViewPreview, , "[ID] = " & me.[ID]
0
 
Jeffrey CoachmanMIS LiasonCommented:
<No Points wanted>

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

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

JeffCoachman
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.