'Range bepalen waarin moet gezocht worden
intFirstRow = objDataSheet.Range("FirstPerformer").Row
intLastRow = objDataSheet.Range("FirstPerformer").End(xlDown).Row
'Lus voor alle rijen in "Data"
For intRow = intFirstRow To intLastRow
'Reset bitje "data voldoet aan criteria"
blnOk = True
'Info om de 10 rijen van "Data"
If intRow Mod 25 = 0 Then
lblsbText.Caption = " Searching... ... " & CStr(intLastRow - intRow) & " records to go."
DoEvents
End If
If ((chkOwner.Value = False) Or _
((chkOwner.Value = True) And (objDataSheet.Cells(intRow, 4).Value <> ""))) Then
'Deze testen enkel maar uitvoeren als Owner = False
' OF Owner = True EN CD Title <> ""
'Lus voor alle kolommen in grid Selection
For i = 1 To grdSelection.Cols - 1
'Check als er een criteria ingevuld is voor die kolom
If grdSelection.Cell(flexcpText, 3, i) <> "" Then
'Exact match of slechts bevatten
Select Case X(i)
'Omschrijving format voor LIKE Code in array X Gebruiken bij
'Only this word data 1 letters en cijfers
'With this word data | *_data | *_data_* | data_* 2 letters
'First word data_* 3 letters
'Last word *_data 4 letters
'With these char *data | *data* | data* 5 letters en cijfers
'Starting with data* 6 cijfers
'Ending with *data 7 cijfers
'
Case 0 'geen selectie ingegeven
lblsbOk.Visible = False
lblsbBusy.Visible = False
lblsbError.Visible = True
lblsbText.Font.Bold = True
lblsbText.Caption = " No search method selected for column [" & grdSelection.Cell(flexcpText, 1, i) & "] !!"
Exit Sub
Case 1 'Only this word: data
strDummy = grdSelection.Cell(flexcpText, 3, i)
If Not objDataSheet.Cells(intRow, i).Value Like strDummy Then
'Data voldoet niet, reset controle bit en lus verlaten (andere kolommen niet meer testen)
blnOk = False
Exit For
End If
Case 2 'With this word: data | *_data | *_data_* | data_*
strDummy = grdSelection.Cell(flexcpText, 3, i)
If Not objDataSheet.Cells(intRow, i).Value Like strDummy Then
'Data voldoet niet, volgende test uitvoeren
strDummy = "* " & grdSelection.Cell(flexcpText, 3, i)
If Not objDataSheet.Cells(intRow, i).Value Like strDummy Then
'Data voldoet niet, volgende test uitvoeren
strDummy = "* " & grdSelection.Cell(flexcpText, 3, i) & " *"
If Not objDataSheet.Cells(intRow, i).Value Like strDummy Then
'Data voldoet niet, volgende test uitvoeren
strDummy = grdSelection.Cell(flexcpText, 3, i) & " *"
If Not objDataSheet.Cells(intRow, i).Value Like strDummy Then
'Data voldoet niet na de vier testen, reset controle bit en lus verlaten (andere kolommen niet meer testen)
blnOk = False
Exit For
End If
End If
End If
End If
Case 3 'First word: data_*
strDummy = grdSelection.Cell(flexcpText, 3, i) & " *"
If Not objDataSheet.Cells(intRow, i).Value Like strDummy Then
'Data voldoet niet, reset controle bit en lus verlaten (andere kolommen niet meer testen)
blnOk = False
Exit For
End If
Case 4 'Last word: *_data
strDummy = "* " & grdSelection.Cell(flexcpText, 3, i)
If Not objDataSheet.Cells(intRow, i).Value Like strDummy Then
'Data voldoet niet, reset controle bit en lus verlaten (andere kolommen niet meer testen)
blnOk = False
Exit For
End If
Case 5 'With these char: *data | *data* | data*
strDummy = "*" & grdSelection.Cell(flexcpText, 3, i)
If Not objDataSheet.Cells(intRow, i).Value Like strDummy Then
'Data voldoet niet, volgende test uitvoeren
strDummy = "*" & grdSelection.Cell(flexcpText, 3, i) & "*"
If Not objDataSheet.Cells(intRow, i).Value Like strDummy Then
'Data voldoet niet, volgende test uitvoeren
strDummy = grdSelection.Cell(flexcpText, 3, i) & "*"
If Not objDataSheet.Cells(intRow, i).Value Like strDummy Then
'Data voldoet niet na de drie testen, reset controle bit en lus verlaten (andere kolommen niet meer testen)
blnOk = False
Exit For
End If
End If
End If
Case 6 'Starting with: data*
strDummy = grdSelection.Cell(flexcpText, 3, i) & "*"
If Not objDataSheet.Cells(intRow, i).Value Like strDummy Then
'Data voldoet niet, reset controle bit en lus verlaten (andere kolommen niet meer testen)
blnOk = False
Exit For
End If
Case 7 'Ending with: *data
strDummy = "*" & grdSelection.Cell(flexcpText, 3, i)
If Not objDataSheet.Cells(intRow, i).Value Like strDummy Then
'Data voldoet niet, reset controle bit en lus verlaten (andere kolommen niet meer testen)
blnOk = False
Exit For
End If
Case Else
lblsbOk.Visible = False
lblsbBusy.Visible = False
lblsbError.Visible = True
lblsbText.Font.Bold = True
lblsbText.Caption = " Error in [Private Sub cmdSearch_Click()_Select Case X(i)] !!"
Exit Sub
End Select
End If
Next i
Else
'Data voldoet niet omwille van Owner
blnOk = False
End If
'Indien data voldoet toevoegen in grdResult
If blnOk = True Then
intCol = 0
intCounter = intCounter + 1
grdResult.Rows = grdResult.Rows + 1
'grdResult.Cell(flexcpText, grdResult.Rows - 1, 0) = CStr(intCounter)
'Lus voor alle kolommen in grid Selection
For i = 1 To grdSelection.Cols - 1
'Check als data gewenst is
If grdSelection.Cell(flexcpChecked, 2, i) = flexChecked Then
grdResult.Cell(flexcpText, grdResult.Rows - 1, intCol) = objDataSheet.Cells(intRow, i).Value
intCol = intCol + 1
End If
Next i
End If
Next intRow