Printing the current record from a form to a report

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

Guest

I have a form and a report that are almost identical. I want to create a
button on the form to allow me to print the report. So say I'm on recordID 15
when I print the report, the report should just have recordID 15's
information. How would I go about setting the criteria for the button?

Thanks
 
Marc said:
I have a form and a report that are almost identical. I want to create a
button on the form to allow me to print the report. So say I'm on recordID 15
when I print the report, the report should just have recordID 15's
information. How would I go about setting the criteria for the button?


Use the OpenReport method's WhereCondition argument to
specify the filter criteria. E.g.

DoCmd.OpenReport . . ., WhereCondition:= "RecordID=" &
Me.RecordID
 
Okay in the macro I created in the where condition field I put "RecordID=" &
[Me].[RecordID]

I attatched the macro to the button in the form, tried to run it, and a pop
up box appears. How come it didn't print the record I was on in my form?
 
I got my button to open the report for the current record. Now how do I get
it to print automatically? When I hit my button I want the report of the
current record to be able to print automatically.
 
Marc said:
I got my button to open the report for the current record. Now how do I get
it to print automatically? When I hit my button I want the report of the
current record to be able to print automatically.


I don't understand the issue. Opening the report either
prints the report directly to a printer or displays it in a
preview window (depending on the view argument). If the
report is open in preview window, users can click on the
Print toolbar button to send it to the printer. I often
provide two form buttons, one for previeing and one for
printing.
 
I wanted the report to print automatically. I didn't want my users to have to
open the report then hit print. I want the user to be able to hit the button
and it automatically sends the report of the current record to the printer.
 
Then set the OpenReport method's View argument to
acViewNormal

If the report is currently opening is preview, then the View
argument you have now is acViewPreview.
 
Back
Top