silentwolf
Active member
- Local time
- Today, 15:47
- Joined
- Jun 12, 2009
- Messages
- 644
Hi guys,
I like to create one filter procedure for different textboxes in a subform
With this code below I am able to filter different textboxes in a subform.
However I like to create one sub procedure to filter the same subform so the code gets a little shorter
This is what I tried
The issue is in the filter ipField.
Could someone tell me how I need to change that line in red so it would work please`?
Cheers
Albert
I like to create one filter procedure for different textboxes in a subform
With this code below I am able to filter different textboxes in a subform.
Code:
Private Sub txtContactNumber_AfterUpdate()
If Not IsNull(Me.txtContactNumber) Then
Me.Filter = "[KndNr] LIKE '*" & Me.txtContactNumber & "*'"
Me![sfmAllContacts].Form.Filter = Me.Filter
Me![sfmAllContacts].Form.FilterOn = True
End If
End Sub
Private Sub txtPLZ_AfterUpdate()
If Not IsNull(Me.txtPLZ) Then
Me.Filter = "[PLZ] LIKE '*" & Me.txtPLZ & "*'"
Me![sfmAllContacts].Form.Filter = Me.Filter
Me![sfmAllContacts].Form.FilterOn = True
End If
End Sub
However I like to create one sub procedure to filter the same subform so the code gets a little shorter
This is what I tried
Code:
Private Sub UpdateData(ByRef ipTextbox As TextBox, ByRef ipForm As SubForm, ByRef ipField As String)
If Not IsNull(ipTextbox) Then
' Me.Filter = "[ipField] LIKE '*" & ipTextbox & "*'"
' Me.Filter = ipField Like " * " & ipTextbox & " * """
' Me.Filter = ipField Like " * " & ipTextbox & " * "
ipForm.Form.Filter = Me.Filter
ipForm.Form.FilterOn = True
End If
End Sub
Code:
Private Sub txtContact_AfterUpdate()
Call UpdateData(Me.txtContact, Me.sfmAllContacts, "KundeName")
End Sub
The issue is in the filter ipField.
Could someone tell me how I need to change that line in red so it would work please`?
Cheers
Albert