printing 1 sheet of report

E

Evert

Hi,

I am trying to print just the one sheet of the report that I have set up.
With help form the user group I'm able to only show the current record on
the form the report comes from. Unfortunately I'm not able to print as
advertised. here is the code:

Private Sub cmdPrint_Click()

DoCmd.OpenReport "rptAlertNotification", acViewPreview
DoCmd.OpenReport "rptAlertNotification", acViewNormal

Reports![rptAlertNotification].Filter = "LPN=" & Me.[tbQADATA.LPN]
Reports![rptAlertNotification].FilterOn = True
DoCmd.Close acForm, "frmALERT"

End Sub

I have added the second and fifth line. the second one to Print and the
fitfth one to close the form the report is based on.
It showss teh current record form the form however, it also does print 28
pages of reports.

How can I modify the code so that I can only print get the current record? I
have tried a macro but it does the same thing. (print 28 pages).

BTW my form is based on a query.

ANY help will be appreciated.

Evert
 
B

BruceM

You need to filter it before you print it. One way is to use the code for
opening the report:

Dim strCriteria As String

strCriteria = "LPN=" & Me.[tbQADATA.LPN]

DoCmd.OpenReport "rptPO", , , strCriteria
DoCmd.Close acForm, "frmALERT"

Note that acViewNormal is the default, so you don't need to specify it.
Note too that if you intend to print the report automatically you do not
need to open it in preview mode. If you intend to look at it first, do not
use normal mode. Choose one or the other.

Evert said:
Hi,

I am trying to print just the one sheet of the report that I have set up.
With help form the user group I'm able to only show the current record on
the form the report comes from. Unfortunately I'm not able to print as
advertised. here is the code:

Private Sub cmdPrint_Click()

DoCmd.OpenReport "rptAlertNotification", acViewPreview
DoCmd.OpenReport "rptAlertNotification", acViewNormal

Reports![rptAlertNotification].Filter = "LPN=" & Me.[tbQADATA.LPN]
Reports![rptAlertNotification].FilterOn = TrueEnd Sub

I have added the second and fifth line. the second one to Print and the
fitfth one to close the form the report is based on.
It showss teh current record form the form however, it also does print 28
pages of reports.

How can I modify the code so that I can only print get the current record?
I
have tried a macro but it does the same thing. (print 28 pages).

BTW my form is based on a query.

ANY help will be appreciated.

Evert
 

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

Top