Public Function ZetFilter(strIn_i As String)
On Error GoTo Err_ZetFilter
Dim iCount As Integer
Dim lngAgrId As Long
Dim strArtNr As String
Dim strArtOms As String
'2 parameters: de groep en het artikelnr
iCount = StrCount(strIn_i, ";")
lngAgrId = StrFirst(strIn_i, ";")
strArtNr = StrNth(strIn_i, ";", 2)
strArtOms = StrNth(strIn_i, ";", iCount + 1)
txtOmsZ = strArtOms
'groep
If lngAgrId <> 0 Then
cboAgrId = lngAgrId
Else
cboAgrId = Null
End If
ToonSub
'zet de focus op het artikelnummer
InLijst strArtNr, strArtOms, False, False
Me.SetFocus
Exit_ZetFilter:
Exit Function
Err_ZetFilter:
MeldingLog Error$
Resume Exit_ZetFilter
End Function
Function InLijst(varArtNr_i As Variant, varArtOms_i As Variant, blnNext_i As Boolean, blnPrev_i As Boolean) As Boolean
On Error GoTo Err_InLijst
Dim qryRes As Recordset
Dim strArtNr As String
Dim strOms As String
strArtNr = varArtNr_i & ""
strOms = varArtOms_i & ""
If strArtNr <> "" Then
Set qryRes = [Hoofd lijst].Form.RecordsetClone
With qryRes
If blnNext_i Then
.FindNext "artNr LIKE """ & strArtNr & "*"""
ElseIf blnPrev_i Then
.FindPrevious "artNr LIKE """ & strArtNr & "*"""
Else
.FindFirst "artNr LIKE """ & strArtNr & "*"""
End If
If Not .NoMatch Then
InLijst = True
[Hoofd lijst].Form.Bookmark = .Bookmark
'SendKeys "{DOWN}"
'SendKeys "{UP}"
'SendKeys "{F2}"
ElseIf blnNext_i Or blnPrev_i Then
MeldingLog "Niet gevonden", vbInformation
End If
.Close
End With
ElseIf strOms <> "" Then
Set qryRes = [Hoofd lijst].Form.RecordsetClone
With qryRes
Dim strTest As String
strTest = ""
Const comma = ","
Dim words As Variant, word As Variant
words = Split(txtOmsZ, comma)
For Each word In words
If Len(Trim(word & "")) > 0 Then strTest = strTest & "[artOms] LIKE '*" & Trim(word) & "*' AND "
Next word
If InStr(strTest, " AND ") > 0 Then strTest = Left(strTest, Len(strTest) - 4)
If blnNext_i Then
.FindNext strTest
ElseIf blnPrev_i Then
.FindPrevious strTest
Else
.FindFirst strTest
End If
If Not .NoMatch Then
InLijst = True
[Hoofd lijst].Form.Bookmark = .Bookmark
'SendKeys "{DOWN}"
'SendKeys "{UP}"
'SendKeys "{F2}"
ElseIf blnNext_i Or blnPrev_i Then
MeldingLog "Niet gevonden", vbInformation
End If
.Close
End With
End If
Exit_InLijst:
Exit Function
Err_InLijst:
MeldingLog Error$
Resume Exit_InLijst
End Function