Printing report

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

Guest

I create a report called Incident report and when I try to print the current
record it prints all of them. How can I stop it from printing them all an
print only the current record.

I have tried going to design view under force new record an changing it to
after section but it does not work. Any help is appreciated. Thanks
 
hi,
in your query behind the report, in the criteria pane
enter the following
[Forms]![yourquery]![yourcontrolID]
where yourquery is the query behind the report
and yourcontrolid is the primary key
 
Check the "wherecondition" argument of the OpenReport method in your code.
You need to specify this to restrict / filter the Report to the current
record on the Form.

Check Access VB Help on the OpenReport method for the use of the
"whercondition" argument.
 
I have all that information correct...still not working

[Forms]![frm Incident Reports]![Incident#]

Sheri

hi,
in your query behind the report, in the criteria pane
enter the following
[Forms]![yourquery]![yourcontrolID]
where yourquery is the query behind the report
and yourcontrolid is the primary key
 
I double check the wherecondition and the argument...it still prints every
record.

This is what I have in the wherecondition:
[Forms]![frm Incident Reports]![Incident#]
 
Assuming that [Incident#] is the numeric Field in the Report's RecordSource,
you need in the "wherecondition" argument:

"[Incident#] = " & Forms![frm Incident Reports]![Incident#]
 
I fix the where condition and it does not work....In my report when I click
print preview it should or suppose to preview the current and print it. I
went to double check my codes and this is what I have:

Private Sub print_preview_button_Click()
On Error GoTo Err_print_preview_button_Click

Dim stDocName As String

stDocName = "macSynchReportToForm"
DoCmd.RunMacro stDocName

Exit_print_preview_button_Click:
Exit Sub

Err_print_preview_button_Click:
MsgBox Err.Description
Resume Exit_print_preview_button_Click

End Sub

Any help is appreciated

Sheri

Van T. Dinh said:
Assuming that [Incident#] is the numeric Field in the Report's RecordSource,
you need in the "wherecondition" argument:

"[Incident#] = " & Forms![frm Incident Reports]![Incident#]


--
HTH
Van T. Dinh
MVP (Access)


Sheri said:
I double check the wherecondition and the argument...it still prints every
record.

This is what I have in the wherecondition:
[Forms]![frm Incident Reports]![Incident#]
 
I am not sure about your naming convention???

Is "macSynchReportToForm" the name of a Macro or the name of the Report?

If it is the name of the Report, you need to use OpenReport Method, not
RunMacro Method. You need to check Access VB Help which explains the use of
these methods (as I mentioned in my first reply).
 
Thanks for all your help I fix the problem. I went into my open report and
change my view to print preview and it does what I want print only current
record. The code that I use is in the macros...my objective is to have my
form to go to my report and click preview and then print... and it works.
Again thanks

Sheri
 
Back
Top