In the below code the select case is working for me.grpSortBy, to pick up the correct type of sorting. However, the select case for me.Criteria is not working to allow the selection of Active, Deleted, All items (cases 1, 2, 3 respectively)
Private Sub command3_Click()
Dim PlantSort As String
Dim strWhere As String
Dim strWhere1 As String
engall.Visible = False
engalll.Visible = False
bfs.Visible = False
bfsl.Visible = False
pfs.Visible = False
pfsl.Visible = False
tc.Visible = False
tcl.Visible = False
powertrain.Visible = False
powertrainl.Visible = False
EngineeringL.Visible = False
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] = 'Area1'"
DoCmd.OpenReport "General Info", acViewPreview, , PlantSort
Case 2
strWhere = "[SortBy] = Project Classification"
PlantSort = "[Plant] = 'Area1'"
DoCmd.OpenReport "General Info", acViewPreview, , PlantSort
Case 3
PlantSort = "[Plant]='Area1'"
DoCmd.OpenReport "General Info By Code", acViewPreview, , PlantSort
End Select
End Sub
Any suggestions?
Thank you for any and all help,
PBrown
Private Sub command3_Click()
Dim PlantSort As String
Dim strWhere As String
Dim strWhere1 As String
engall.Visible = False
engalll.Visible = False
bfs.Visible = False
bfsl.Visible = False
pfs.Visible = False
pfsl.Visible = False
tc.Visible = False
tcl.Visible = False
powertrain.Visible = False
powertrainl.Visible = False
EngineeringL.Visible = False
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] = 'Area1'"
DoCmd.OpenReport "General Info", acViewPreview, , PlantSort
Case 2
strWhere = "[SortBy] = Project Classification"
PlantSort = "[Plant] = 'Area1'"
DoCmd.OpenReport "General Info", acViewPreview, , PlantSort
Case 3
PlantSort = "[Plant]='Area1'"
DoCmd.OpenReport "General Info By Code", acViewPreview, , PlantSort
End Select
End Sub
Any suggestions?
Thank you for any and all help,
PBrown