Printing a Report

  • Thread starter Thread starter Doug
  • Start date Start date
D

Doug

I have a form that comes from a query, when the Report #
is entered it brings up a single record. I need to print a
report from the current record that is displayed on the
form. This report also comes from the same query as the
form. Is there any way to make the print button print the
current record without asking the user to enter the report
# again ? Thanks
Doug
 
Doug said:
I have a form that comes from a query, when the Report #
is entered it brings up a single record. I need to print a
report from the current record that is displayed on the
form. This report also comes from the same query as the
form. Is there any way to make the print button print the
current record without asking the user to enter the report
# again ?


You can filter a report by using the OpenReport method's
WhereCondition argument. If you'll look at the code in the
form's module and find the button's Click event, then change
it to be along these lines:

Dim stDoc As String
Dim stWhere As String
stDoc = "nameof report"
stWhere = "primarykeyfield = " & Me.primarykeytextbox
DoCmd.OpenReport stDoc, acViewPreview, , stWhere
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top