theinviter
Registered User.
- Local time
- Today, 15:01
- Joined
- Aug 14, 2014
- Messages
- 253
Dears;
i would like to ask a support.
I had a form where the user scan the bar code in text field, so after scanning need to find the code in 3 different filed and filter the form.
IF code not present in Field 1 ( Code1) then search in field 2
If code not present in Field 2 (Code2) then search in field 2
If code not present in Field 3 (Code 3) Msgbox " code not found"
I tired below but do not know how to add to 3 items.
Private Sub filterThisForm2()
On Error GoTo errhandler:
N = 1 / 0 ' cause an error
Dim strFilter As String
If Len(Me!Combo80 & "") <> 0 Then
strFilter = strFilter & "[Item] Like """ & Me!Combo80 & """ And "
End If
If Len(Me!FindCode & "") <> 0 Then
strFilter = strFilter & "
i would like to ask a support.
I had a form where the user scan the bar code in text field, so after scanning need to find the code in 3 different filed and filter the form.
IF code not present in Field 1 ( Code1) then search in field 2
If code not present in Field 2 (Code2) then search in field 2
If code not present in Field 3 (Code 3) Msgbox " code not found"
I tired below but do not know how to add to 3 items.
Private Sub filterThisForm2()
On Error GoTo errhandler:
N = 1 / 0 ' cause an error
Dim strFilter As String
If Len(Me!Combo80 & "") <> 0 Then
strFilter = strFilter & "[Item] Like """ & Me!Combo80 & """ And "
End If
If Len(Me!FindCode & "") <> 0 Then
strFilter = strFilter & "
Code:
Like """ & Me!FindCode & """ And "
End If
If Len(strFilter) <> 0 Then
strFilter = Left$(strFilter, Len(strFilter) - 5)
With Me
.Filter = strFilter
.FilterOn = True
End With
Else
Me.FilterOn = False
End If
Exit Sub
errhandler:
' error handling code
Resume Next