Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sort by Select Case

Status
Not open for further replies.

MICKI0220

IS-IT--Management
Jul 20, 2004
337
US
I am trying to sort a report by code in order to avoid making five separate reports. I have a form that I am trying to reference when opening a report. The code is below which is in the report. The form has a option group created based on the commented out names with the values = to the Case number. Can someone tell me what is wrong? When I run the report it goes to debug and highlights the Select Case statement.

Private Sub Report_Open(Cancel As Integer)
Select Case Form!frmChooseSort!grpSort
Case 1 'State
Me.GroupLevel(0).ControlSource = "Date Bid"
Me.GroupLevel(1).ControlSource = "Low Bidder Code"
Me.GroupLevel(2).ControlSource = "State"
Case 2 'Capacity
Me.GroupLevel(0).ControlSource = "Date Bid"
Me.GroupLevel(1).ControlSource = "Low Bidder Code"
Me.GroupLevel(2).ControlSource = "Capacity"
Me.GroupLevel(3).ControlSource = "Tank Type"
Case 3 'TankType
Me.GroupLevel(0).ControlSource = "Date Bid"
Me.GroupLevel(1).ControlSource = "Low Bidder Code"
Me.GroupLevel(2).ControlSource = "Capacity"
Me.GroupLevel(3).ControlSource = "Tank Type"
Me.GroupLevel(4).ControlSource = "State"
Case 4 'TankType-State
Me.GroupLevel(0).ControlSource = "Date Bid"
Me.GroupLevel(1).ControlSource = "Tank Type"
Me.GroupLevel(2).ControlSource = "State"
Case 5 'Bidder-TankType
Me.GroupLevel(0).ControlSource = "Date Bid"
Me.GroupLevel(1).ControlSource = "Low Bidder Code"
Me.GroupLevel(2).ControlSource = "Tank Type"
End Select
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top