Report

  • Thread starter Thread starter Andrew C
  • Start date Start date
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
 
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.
 
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
 
Back
Top