You may, at times, wish to only print the record that you are currently displaying in your Microsoft Access form. This can be done directly from the Form's File » Print Option and choosing Print Range » Selected Record(s).
However, forms are not really optimized to print out records and you may wish to present your data in a more user friendly approach.
Question » From a command button on my form, is it possible to print a report of only the current record?
Answer » Yes, You will need to define a WHERE clause in the DoCmd.OpenReport method
DoCmd.OpenReport reportname [, view][, filtername][, wherecondition]
DoCmd.OpenReport "rptEmployeeDetails", acViewPreview, , _ "[lngEmpID]=Forms!frmEmployee
The first section DoCmd. OpenReport "rptEmployeeDetails",acViewPreview can be broken down as:
DoCmd.OpenReport is opening the report - "rptEmployeeDetails".
acViewPreview is opening the report in Print Preview mode.
The last section enclosed in the double quotes is the criteria which can be broken down as:
[lngEmpID] is the name on the unique fieldname of the record that identifies the record you want to print - it could be the Primary Key.
Forms!frmEmployeeDetails !lngEmpID is the place where the value of lngEmpID is to be found. In this case, On a form called 'frmEmployeeDetails' in a control called 'lngEmpID'
This method assumes that the record has already been selected on a form prior to printing. The Report name here is "rptEmployeeDetails".