Zippersabrat
Blah Blah Blah :o)
- Local time
- Yesterday, 17:27
- Joined
- May 5, 2010
- Messages
- 31
I am going nuts with this. No errors and it filters perfectly on the Product Group but it will not filter on Product Type. Help! :banghead:
The goal is to filter a subform [Central Structure Product List] based on given values for Product Group and Product Type. I have another code on both fields to re-filter after update and those work great. Just cannot get this one to do both fields at once on load.
And yes, I shamelessly stole this code from another post.
The goal is to filter a subform [Central Structure Product List] based on given values for Product Group and Product Type. I have another code on both fields to re-filter after update and those work great. Just cannot get this one to do both fields at once on load.
And yes, I shamelessly stole this code from another post.
Code:
Private Sub Form_Load()
Dim StrFilter1 As String
Dim StrFilter2 As String
Dim StrFilter As String
If IsNull(Me.ProductGroup.Value) Then
StrFilter1 = "Like '*'"
Else
StrFilter1 = "='" & Me.ProductGroup.Value & "'"
End If
If IsNull(Me.ProductType.Value) Then
StrFilter2 = "Like '*'"
Else
StrFilter2 = "='" & Me.ProductType.Value & "'"
End If
StrFilter = "[CSProductType] " & StrFilter2 & " And [CSProductGroup] " & StrFilter1 & ""
With Me![Central Structure Product List].Form
.Filter = StrFilter
.FilterOn = True
End With
[Label761].Visible = False
[Details].Visible = False
[Question].Visible = False
[Label760].Visible = False
[Label869].Visible = False
[CentralCode].Visible = False
End Sub