How to Sort Rpt by different fields

  • Thread starter Thread starter Bonnie
  • Start date Start date
B

Bonnie

Hi folks! Using A02. I know this has to be simple but I
can't find a beginner's example. My report is sorted by
contract number and bang! don't cha know, somebody just
has to have it sorted by contract name, but only
sometimes...feel my pain. I'm tired of creating 2 queries
and 2 reports. I know it can be done with just one, but
I'm not a programmer so I need something more
beginner/intermediate.

Thanks in advance for any help or advice!!!
 
I got this from previous posts

Check Allen Browne's site for a solution
http://members.iinet.net.au/~allenbrowne/ser-33.html.

MS-Access Tips for Serious Users

Provided by Andy Baron ([email protected])
Sorting Records in a Report

Access reports do their own sorting based on the sort
fields you specify in the Sorting and Grouping dialog of
the report. The recordsource Order By clause is ignored.

Microsoft has a knowledgebase article that explains a
technique for using setting the OrderBy property of a
report by opening the report in design view (Article ID:
Q146310).

I have always preferred to programmatically set the group
levels of the report, with code like this in the Open event
of the report:

Select Case Forms!frmChooseSort!grpSort
Case 1 'Name
Me.GroupLevel(0).ControlSource = "LastName"
Me.GroupLevel(1).ControlSource = "FirstName"
Me.GroupLevel(2).ControlSource = "Company"
Case 2 'Company
Me.GroupLevel(0).ControlSource = "Company"
Me.GroupLevel(1).ControlSource = "LastName"
Me.GroupLevel(2).ControlSource = "FirstName"
End Select

To make this work, you just need to make sure that you have
set up the right number of grouping levels in the report's
grouping and sorting dialog.

Good luck

Jim
 
Back
Top