What I am attempting to do is allow the user to choose they type of items from Me.Criteria (Case 1 = “Active”, Case 2 = “Deleted”, Case 3 = “All”) as well as how they want to sort the data from Me.GrpSortBy. As it is written right now, the Me.GrpSortBy works just fine. However, no matter which Criteria is choosen, it always shows all data. Therefore, I need to know how to combine both cases for the report.
Private Sub command3_Click()
Dim PlantSort As String
Dim strWhere As String
Dim strWhere1 As String
DoCmd.RunMacro “PlantCombo”
gstrTitle = “Composition / Status”
Select Case Me.Criteria
Case 1
strWhere1 = “[Deleted] = False”
Case 2
strWhere1 = “[Deleted] = True”
Case 3
strWhere1 = “[Deleted] <=0" ' nothing needed to get all records"
End Select
Select Case Me.grpSortBy
Case 1
strWhere = "[SortBy] = Y1Sum"
PlantSort = "[Plant] = 'Altima Trim & Chassis'"
DoCmd.OpenReport "General Info", acViewPreview, , PlantSort
Case 2
strWhere = "[SortBy] = Project Classification"
PlantSort = "[Plant] = 'Altima Trim & Chassis'"
DoCmd.OpenReport "General Info", acViewPreview, , PlantSort
Case 3
PlantSort = "[Plant]='Altima Trim & Chassis'"
DoCmd.OpenReport "General Info By Code", acViewPreview, , PlantSort
End Select
End Sub
The reason I wrote the Me.GrpSortBy like I did (including the running report, ect. at that time) was because if Case 1 or Case 2 is choosen, (1) report is ran and it is just sorted differently. However it Case 3 is choosen a different report runs.
Any ideas on how to get this to work?