Cascading Combo boxes with Number Field

AgDawg

Registered User.
Local time
Yesterday, 21:25
Joined
Oct 12, 2012
Messages
24
I have the cascading filters working perfectly for all my different applications. I now have a number thats in a combo box but I know its a different data type. How should I modify my code? The combo box causing issues is cbosupport as its a number data type while the others are text.

Code:
Private Sub cboSupport_AfterUpdate()
Dim strFilter As String
 
If Len(Me.cboProductFilter & vbNullString) > 0 Then
   strFilter = "[Product]=" & Chr(34) & Me.cboProductFilter & Chr(34) & " AND "
End If

If Len(Me.cboSupport & vbNullString) > 0 Then
  strFilter = strFilter & "[Support Level]=" & Chr(34) & Me.cboSupport & Chr(34) & " AND "
End If

If Len(Me.Combo85 & vbNullString) > 0 Then
  strFilter = strFilter & "[Active Ingredient]=" & Chr(34) & Me.Combo85 & Chr(34) & " AND "
End If
 
If Right(strFilter, 5) = " AND " Then
   strFilter = Left(strFilter, Len(strFilter) - 5)
End If
 
Me.Filter = strFilter
Me.FilterOn = True
End Sub
 
Last edited:
The error message that I keep getting says its a data type mismatch.
 
I think I missing a comma or some quotes somewhere for it to work with numeric data.

This gives me a data mismatch as well but I think I am close.

If Len(Me.cboSupport & vbNullString) > 0 Then
strFilter = strFilter & "[Support Level] = '" & Me.cboSupport & "'" And ""
End If
 

Users who are viewing this thread

Back
Top Bottom