Command button to print a report

  • Thread starter Thread starter Kathleen
  • Start date Start date
K

Kathleen

I'm trying to put a command button on a form that will
print a single record from a report. I want to restrict
the records that are printed in the report. At the moment
the full report is printing.
 
Kathleen said:
I'm trying to put a command button on a form that will
print a single record from a report. I want to restrict
the records that are printed in the report. At the moment
the full report is printing.
Base the report on a query.
In the criteria for the key field in that query place
Forms!YourFormName!YourKeyFieldName

The report will only print for that record.
 
Mike, thank you. Unfortunately it's not working for me.

I've based the report on a query and used the following
criteria on the PK field.

Forms!frmEmployee!EmployeeID

I get a request to enter a parameter value.
 
An easy way to do what you want is to add a command button on the form. In
the button's on-click event create a macro to open your report. In the
macro's Where condition enter the following expression
[Client ID]=Forms![OpenFormName]![Client ID]

Of course the field (Client ID] should be replaced by whatever is the
primary key on the form.

Con Giacomini
 
Make a criteria in a query. Create a report based on that
query. Go to your form with the command button. Link
your command button to the report. When the button is
clicked, a pop up box will ask you for a criteria. It
will create a report based on only what you typed.
 
Back
Top