Print Only One Record

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I have a Form only print out the current record. I know I can go to
File, Print, Current Record, but is there a macro available. Second, is
there away to make sure a form only prints on one page.

Thanks
 
Why are you printing a form instead of a report. Forms are not really well
suited for printing. That's what reports are for.
 
Use the Where argument of the OpenReport method. Create a report that
presents the data you want and base it on the same table or query you use for
the report.
The current record should have a field that is unique. You use that in the
Where argument to tell the report which record to print. For example
purposes, let's say it is an employee record and that we use the employee's
ID number:
txtEmpID - is the control on the form
[EMP_ID] - is the field in the table and it is a text field

strWhere = "[EMP_ID] = '" & Me.txtEmpID & "'"
DoCmd.OpenReport "rptEmpRec", acNormal, ,strWhere

Using a unique field value will mean that only the current record will be
printed. On the other hand, lets say you wanted to print all the records for
department 309 and the Department Number is a numeric field

strWhere = "[DEPT_NO] = " & Me.txtDept
DoCmd.OpenReport "rptEmpRec", acNormal, ,strWhere

Now you will get a report for all the employees in the department that the
current record employee is in.
 
Back
Top