E
Elvis72
Here is the code, I have split the search criteria because it was just too
long and I have no idea how to work around that:
Private Sub Command212_Click()
Dim strWhere As String
Dim lngLen As Long
strWhere = strWhere & "([Commissioning] = " & Me!cboFilterCommissioning & ")
AND "
strWhere = strWhere & "([ Steam Line Blowing] = " &
Me!cboFilterSteamLineBlowing & ") AND "
strWhere = strWhere & "([Chemical Cleaning] = " &
Me!cboFilterChemicalCleaning & ") AND "
strWhere = strWhere & "([Commissioning I and E] = " &
Me!cboFilterCommissioningIandE & ") AND "
strWhere = strWhere & "([Turnover Coordination] = " &
Me!cboFilterTurnoverCoordination & ") AND "
strWhere = strWhere & "([Commissioning Planning] = " &
Me!cboFilterCommissioningPlanning & ") AND "
strWhere = strWhere & "([Facility Evaluation] = " &
Me!cboFilterFacilityEvaluation & ") AND "
strWhere = strWhere & "([Operation Preparedness] = " &
Me!cboFilterOperationPreparedness & ") AND "
strWhere = strWhere & "([Corrosion Program] = " &
Me!cboFilterCorrosionProgram & ") AND "
strWhere = strWhere & "([Fugitive Emission Testing] = " &
Me!cboFilterFugitiveEmissionTesting & ") AND "
strWhere = strWhere & "([NDT Certification] = " &
Me!cboFilterNDTCertification & ") AND "
strWhere = strWhere & "([Maintenance] = " & Me!cboFilterMaintenance & ") AND "
strWhere = strWhere & "([Maintenance Planning] = " &
Me!cboFilterMaintenancePlanning & ") AND "
strWhere = strWhere & "([Piping] = " & Me!cboFilterPiping & ") AND "
strWhere = strWhere & "([Rotating] = " & Me!cboFilterRotating & ") AND "
strWhere = strWhere & "([Maintenance I and E] = " &
Me!cboFilterMaintenanceIandE & ") AND "
strWhere = strWhere & "([Operations] = " & Me!cboFilterOperations & ") AND "
strWhere = strWhere & "([Operations Planning] = " &
Me!cboFilterOperationsPlanning & ") AND "
strWhere = strWhere & "([Scheduling] = " & Me!cboFilterScheduling & ") AND "
strWhere = strWhere & "([Inventory of Supply] = " &
Me!cboFilterInventoryofSupply & ") AND "
strWhere = strWhere & "([Product Movement] = " & Me!cboFilterProductMovement
& ") AND "
strWhere = strWhere & "([Start-Up] = " & Me!cboFilterStartUp & ") AND "
strWhere = strWhere & "([Temporary] = " & Me!cboFilterTemporary & ") AND "
strWhere = strWhere & "([Long-Term] = " & Me!cboFilterLongTerm & ") AND "
strWhere = strWhere & "([PandID Reviews] = " & Me!cboFilterPandIDReviews &
") AND "
strWhere = strWhere & "([Preliminary] = " & Me!cboFilterPreliminary & ") AND "
strWhere = strWhere & "([As Built] = " & Me!cboFilterAsBuilt & ") AND "
strWhere = strWhere & "([HAZOP Participation] = " &
Me!cboFilterHAZOPParticipation & ") AND "
strWhere = strWhere & "([Training] = " & Me!cboFilterTraining & ") AND "
strWhere = strWhere & "([Create Training Material] = " &
Me!cboFilterCreateTrainingMaterial & ") AND "
strWhere = strWhere & "([Presenter] = " & Me!cboFilterPresenter & ") AND "
strWhere = strWhere & "([Technical Writing] = " &
Me!cboFilterTechnicalWriting & ") AND "
strWhere = strWhere & "([Understanding of Material] = " &
Me!cboFilterUnderstandingofMaterial & ") AND "
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "No criteria", vbInformation, "Nothing to do."
Else
strWhere = Left$(strWhere, lngLen)
Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub
But it is still coming up with errors on the Me.Filters.
long and I have no idea how to work around that:
Private Sub Command212_Click()
Dim strWhere As String
Dim lngLen As Long
strWhere = strWhere & "([Commissioning] = " & Me!cboFilterCommissioning & ")
AND "
strWhere = strWhere & "([ Steam Line Blowing] = " &
Me!cboFilterSteamLineBlowing & ") AND "
strWhere = strWhere & "([Chemical Cleaning] = " &
Me!cboFilterChemicalCleaning & ") AND "
strWhere = strWhere & "([Commissioning I and E] = " &
Me!cboFilterCommissioningIandE & ") AND "
strWhere = strWhere & "([Turnover Coordination] = " &
Me!cboFilterTurnoverCoordination & ") AND "
strWhere = strWhere & "([Commissioning Planning] = " &
Me!cboFilterCommissioningPlanning & ") AND "
strWhere = strWhere & "([Facility Evaluation] = " &
Me!cboFilterFacilityEvaluation & ") AND "
strWhere = strWhere & "([Operation Preparedness] = " &
Me!cboFilterOperationPreparedness & ") AND "
strWhere = strWhere & "([Corrosion Program] = " &
Me!cboFilterCorrosionProgram & ") AND "
strWhere = strWhere & "([Fugitive Emission Testing] = " &
Me!cboFilterFugitiveEmissionTesting & ") AND "
strWhere = strWhere & "([NDT Certification] = " &
Me!cboFilterNDTCertification & ") AND "
strWhere = strWhere & "([Maintenance] = " & Me!cboFilterMaintenance & ") AND "
strWhere = strWhere & "([Maintenance Planning] = " &
Me!cboFilterMaintenancePlanning & ") AND "
strWhere = strWhere & "([Piping] = " & Me!cboFilterPiping & ") AND "
strWhere = strWhere & "([Rotating] = " & Me!cboFilterRotating & ") AND "
strWhere = strWhere & "([Maintenance I and E] = " &
Me!cboFilterMaintenanceIandE & ") AND "
strWhere = strWhere & "([Operations] = " & Me!cboFilterOperations & ") AND "
strWhere = strWhere & "([Operations Planning] = " &
Me!cboFilterOperationsPlanning & ") AND "
strWhere = strWhere & "([Scheduling] = " & Me!cboFilterScheduling & ") AND "
strWhere = strWhere & "([Inventory of Supply] = " &
Me!cboFilterInventoryofSupply & ") AND "
strWhere = strWhere & "([Product Movement] = " & Me!cboFilterProductMovement
& ") AND "
strWhere = strWhere & "([Start-Up] = " & Me!cboFilterStartUp & ") AND "
strWhere = strWhere & "([Temporary] = " & Me!cboFilterTemporary & ") AND "
strWhere = strWhere & "([Long-Term] = " & Me!cboFilterLongTerm & ") AND "
strWhere = strWhere & "([PandID Reviews] = " & Me!cboFilterPandIDReviews &
") AND "
strWhere = strWhere & "([Preliminary] = " & Me!cboFilterPreliminary & ") AND "
strWhere = strWhere & "([As Built] = " & Me!cboFilterAsBuilt & ") AND "
strWhere = strWhere & "([HAZOP Participation] = " &
Me!cboFilterHAZOPParticipation & ") AND "
strWhere = strWhere & "([Training] = " & Me!cboFilterTraining & ") AND "
strWhere = strWhere & "([Create Training Material] = " &
Me!cboFilterCreateTrainingMaterial & ") AND "
strWhere = strWhere & "([Presenter] = " & Me!cboFilterPresenter & ") AND "
strWhere = strWhere & "([Technical Writing] = " &
Me!cboFilterTechnicalWriting & ") AND "
strWhere = strWhere & "([Understanding of Material] = " &
Me!cboFilterUnderstandingofMaterial & ") AND "
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "No criteria", vbInformation, "Nothing to do."
Else
strWhere = Left$(strWhere, lngLen)
Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub
But it is still coming up with errors on the Me.Filters.