Printing one page of a report from a command button on a form

  • Thread starter Thread starter Pamela
  • Start date Start date
P

Pamela

I need some help!
I have a button on a form to print a report. It will print
the whole report but I only need a report printed for the
open record. How can I only print one page of a report
instead of the whole thing, with the button on the form.
Thanks!
I am sooo frustrated!
 
Pamela said:
I have a button on a form to print a report. It will print
the whole report but I only need a report printed for the
open record. How can I only print one page of a report
instead of the whole thing, with the button on the form.


You can use the OpenReport method's WhereCondition argument
to do this. Find the button's Click event procedure and
adjust its code to look something like:

Dim stDoc As String
Dim stWhere As String
stDoc = "nameofthereport"
stWhere = "keyfield = " & Me.keyfield
DoCmd.OpenReport stDoc, , , stWhere

If the keyfield is a Text type field, then change the above
line to include quotes around the value:
stWhere = "keyfield = """ & Me.keyfield & """"
 
Back
Top