theinviter
Registered User.
- Local time
- Yesterday, 20:21
- Joined
- Aug 14, 2014
- Messages
- 244
Dears:
i have created a form that contain a search textbox, once user update then it will filter the form.
i have applied the below code but it apply the filter on both form and subform .
so can you please advise me how to correct to filter form only.
Private Sub FindCode_AfterUpdate()
On Error GoTo errhandler
''n = 1 / 0 ' cause an error
Dim strFilter As String
strFilter = ""
If Len(Me.FindCode & "") <> 0 Then
strFilter = " or '' &
i have created a form that contain a search textbox, once user update then it will filter the form.
i have applied the below code but it apply the filter on both form and subform .
so can you please advise me how to correct to filter form only.
Private Sub FindCode_AfterUpdate()
On Error GoTo errhandler
''n = 1 / 0 ' cause an error
Dim strFilter As String
strFilter = ""
If Len(Me.FindCode & "") <> 0 Then
strFilter = " or '' &
Code:
Like '" & Me.FindCode & "'"
End If
If Len(Me.FindCode & "") <> 0 Then
strFilter = strFilter & " or '' & [Other Code] Like '" & Me.FindCode & "'"
End If
If Len(strFilter) > 0 Then
strFilter = Mid(strFilter, 4)
With Me
.Filter = strFilter
.FilterOn = True
Me.Table1_Subform.SetFocus
DoCmd.GoToControl ("[Qnty_IN]")
DoCmd.GoToRecord , , acNewRec
End With
Else
'Me.Filter = ""
Me.FilterOn = False
End If
Exit Sub
errhandler:
' error handling code
Resume Next
End Sub