Print the Current Record

  • Thread starter Thread starter DB
  • Start date Start date
D

DB

I'm trying to create a command button on an Access 2000
form that will allow an end user to open a report, print
the current record then close the report and return to
the form so they may continue their input. I tried
several ways to create a macro using OpenReport however
it either prompts me to enter the field name or it prints
all pages EXCEPT the current record. Either way, I
receive "#Error" in the field and the rest of the report
is blank.
 
How to Print Just the Current Record on a Form:

Method #1
This assumes each record has a unique primary key field of Number Datatype.
DoCmd.OpenReport "ReportName",acViewPreview, , "[RecordID] = " & [RecordID]

Method #2
Write a query that references the key field of your form as the criteria.
Forms![FormName]![EmployeeID]

This query will return just the current record.

Then write a report based on this query.

Finally, put a button on the form to open the report.

Note that as you change records, the query results change with it because
they always reference the key field of the form. Thus, your report always
prints the current record.
 
Answered elsewhere.
Please do not multi-post. if you feel you must post the same question to
more than one newsgroup (and it's seldom necessary), cross-post by adding
each additional newsgroup in the To Newsgroups: box, separated by a comma.
This way an answer in one newsgroup will be seen in each of the others. More
readers will see the response and learn, and less time will be spent on
duplicate answers.

See Netiquette at http://www.mvps.org/access

It's a great site to visit anyway.
 
Back
Top