Pulling individual Pages from Reports

B

bob6003

I have a report that lists all attendees at a function with attendant
details. I would like to be able to tell the report to pull a page for just
One of the attendees and not print the entire report. Is this possible. I'm
very new at access. Please be gentle.
 
F

fredg

I have a report that lists all attendees at a function with attendant
details. I would like to be able to tell the report to pull a page for just
One of the attendees and not print the entire report. Is this possible. I'm
very new at access. Please be gentle.

Create a report that shows all of the attendees (as you appear to
already have done).
Then restrict the data to the report to just the one attendee you
wish. There are several ways to do this.

1) Using a form, add a command button.

Your table should have a unique prime key field.
In my example it is named [RecordID].

On the command button's property sheet write
[Event Procedure]
on the Click event line.
Then click on the little button with 3 dots that will appear on that
line.
When the code window opens, the cursor will be flashing between 2
already existing lines of code.
Between those 2 lines write:

DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport "ReportName", acViewPreview, , "[RecordID] = " &
[RecordID]

The above assumes a [RecordID] field that is a Number Datatype.

If, however, [RecordID] is Text Datatype, then use:

DoCmd.OpenReport "ReportName", acViewPreview, ,"[RecordID] = '" &
[RecordID] & "'"

as the Where clause.

For clarity, the single and double quotes are..
"[RecordID] = ' " & [RecordID] & " ' "
Change [RecordID] to whatever the actual field name is that you are
using.

See VBA Help files for:
Where Clause + Restrict data to a subset of records'

Open the form and display the attendee's record. Click the command
button.

Or ....
2) Create a query to use as the report's record source.
As criteria on the AttendeeID column, write:
[Enter Attendee ID]

You will be prompted to enter the Attendee's ID.
The report will show only that person's records.

Note: Always use the [AttendeeID] field, as there may be more than one
attendee with the same name.
 
B

bob6003

Thank you. Worked like a charm.

fredg said:
I have a report that lists all attendees at a function with attendant
details. I would like to be able to tell the report to pull a page for just
One of the attendees and not print the entire report. Is this possible. I'm
very new at access. Please be gentle.

Create a report that shows all of the attendees (as you appear to
already have done).
Then restrict the data to the report to just the one attendee you
wish. There are several ways to do this.

1) Using a form, add a command button.

Your table should have a unique prime key field.
In my example it is named [RecordID].

On the command button's property sheet write
[Event Procedure]
on the Click event line.
Then click on the little button with 3 dots that will appear on that
line.
When the code window opens, the cursor will be flashing between 2
already existing lines of code.
Between those 2 lines write:

DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport "ReportName", acViewPreview, , "[RecordID] = " &
[RecordID]

The above assumes a [RecordID] field that is a Number Datatype.

If, however, [RecordID] is Text Datatype, then use:

DoCmd.OpenReport "ReportName", acViewPreview, ,"[RecordID] = '" &
[RecordID] & "'"

as the Where clause.

For clarity, the single and double quotes are..
"[RecordID] = ' " & [RecordID] & " ' "
Change [RecordID] to whatever the actual field name is that you are
using.

See VBA Help files for:
Where Clause + Restrict data to a subset of records'

Open the form and display the attendee's record. Click the command
button.

Or ....
2) Create a query to use as the report's record source.
As criteria on the AttendeeID column, write:
[Enter Attendee ID]

You will be prompted to enter the Attendee's ID.
The report will show only that person's records.

Note: Always use the [AttendeeID] field, as there may be more than one
attendee with the same name.
 

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