How print only current record?

  • Thread starter Thread starter SteveL
  • Start date Start date
S

SteveL

I have a form which is bound to a table from which I can
step through all the records in that table.

I am adding a control button to the form which will
preview a report which I've written.

But, I want to have it only print preview the current
record, not all the records. Is there code I can put
into the onclick event which will do this for me?

--Steve
 
SteveL said:
I have a form which is bound to a table from which I can
step through all the records in that table.

I am adding a control button to the form which will
preview a report which I've written.

But, I want to have it only print preview the current
record, not all the records. Is there code I can put
into the onclick event which will do this for me?

The VBA method for opening a Report...

DoCmd.OpenReport "ReportName"

....has an optional WHERE argument. You just need to use that to filter the
Report on the Primary Key value currently displayed in the Form. If this
PK was a numeric field named [ID] the syntax would be something like...

DoCmd.OpenReport "ReportName",,,"[ID] = " & Me![ID]
 
-----Original Message-----
I have a form which is bound to a table from which I can
step through all the records in that table.

I am adding a control button to the form which will
preview a report which I've written.

But, I want to have it only print preview the current
record, not all the records. Is there code I can put
into the onclick event which will do this for me?

The VBA method for opening a Report...

DoCmd.OpenReport "ReportName"

....has an optional WHERE argument. You just need to use that to filter the
Report on the Primary Key value currently displayed in the Form. If this
PK was a numeric field named [ID] the syntax would be something like...

DoCmd.OpenReport "ReportName",,,"[ID] = " & Me![ID]


--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


.
Rick... PERFECT!!! Thank you very much!

--Steve
 
In the query that the report is based on go to the field
with the unique number and in the criteria right click
then click on build select the form you have the button
on for opening the report in question (it will be easier
to find if you already have the form open) look in forms
loaded forms select the form, then select the control
with the matching key field click ok

good luck
-----Original Message-----
-----Original Message-----
I have a form which is bound to a table from which I can
step through all the records in that table.

I am adding a control button to the form which will
preview a report which I've written.

But, I want to have it only print preview the current
record, not all the records. Is there code I can put
into the onclick event which will do this for me?

The VBA method for opening a Report...

DoCmd.OpenReport "ReportName"

....has an optional WHERE argument. You just need to use that to filter the
Report on the Primary Key value currently displayed in the Form. If this
PK was a numeric field named [ID] the syntax would be something like...

DoCmd.OpenReport "ReportName",,,"[ID] = " & Me![ID]


--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


.
Rick... PERFECT!!! Thank you very much!

--Steve


.
 
Back
Top