Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB help to print a single record in a report

Status
Not open for further replies.

Tfrank

Technical User
Jun 19, 2001
30
US
I need help with some VB coding as I am a novice in VB. I need to create a button on a form such that it will print a single page from a report in which the report page corresponds to the record showing on the form.

Thanks in advance for the help.

Tfrank
 
use the docmd.openreport command to open the report and pass the report some criteria which will define your current record

Example:

Dim Criteria as string

Criteria = "[Primkeyfield] = " & me![formfield]
docmd.openreport "Report Name",acpreview,,Criteria


My syntax may not be exactly correct. Use access help to get the full syntax for the openreport command. Also you will need to add single or double quotes if your primary key is a text field.
Maq B-)
<insert witty signature here>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top