Report

A

Andrew C

I Have a report that lists all people attendind a function. THere are quite
a few people so i need to break the report down into sections.

I need to list people by surname from A - K and the a seperate one for L - Z
users will push a command button to open the same report but im not sure of
the code need to do these reports.

The reports name is (Attendance) - and is based on query (Attendance List)
and has members surnames and first names.

Thanks

Andrew
 
K

Ken Snell \(MVP\)

You want two separate reports? And to open them from the same form, using
two separate buttons?

Probably easiest things to do are these steps:

1) Add a calculated field to the query that the report uses as its record
source. This field should return the first letter of the person's surname:

SortingField: Left([SurnameField], 1)


2) Put the two command buttons on your form. Name one cmdAK and the other
cmdLZ.


3) Code the Click event of the cmdAK button this way:

Private Sub cmdAK_Click()
DoCmd.OpenReport "ReportName", , , "SortingField<='K'"
End Sub


4) Code the Click event of the cmdLZ button this way:

Private Sub cmdLZ_Click()
DoCmd.OpenReport "ReportName", , , "SortingField>='L'"
End Sub



You're all set.
 
A

Andrew C

Thank you Ken Works Great

Andrew

Ken Snell (MVP) said:
You want two separate reports? And to open them from the same form, using
two separate buttons?

Probably easiest things to do are these steps:

1) Add a calculated field to the query that the report uses as its record
source. This field should return the first letter of the person's surname:

SortingField: Left([SurnameField], 1)


2) Put the two command buttons on your form. Name one cmdAK and the other
cmdLZ.


3) Code the Click event of the cmdAK button this way:

Private Sub cmdAK_Click()
DoCmd.OpenReport "ReportName", , , "SortingField<='K'"
End Sub


4) Code the Click event of the cmdLZ button this way:

Private Sub cmdLZ_Click()
DoCmd.OpenReport "ReportName", , , "SortingField>='L'"
End Sub



You're all set.
--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/


Andrew C said:
I Have a report that lists all people attendind a function. THere are
quite
a few people so i need to break the report down into sections.

I need to list people by surname from A - K and the a seperate one for L -
Z
users will push a command button to open the same report but im not sure
of
the code need to do these reports.

The reports name is (Attendance) - and is based on query (Attendance List)
and has members surnames and first names.

Thanks

Andrew
 

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