mattbland
Isnt really listening
- Local time
- Today, 20:27
- Joined
- Aug 8, 2002
- Messages
- 33
ive got a combo box and a textbox both unbound for finding a particular field. what i want to happen is select either 'product code' or ingredient name' from the combo box, and then search either of these fields as the filter i am using only searches either a numeric field (product code) or text field (product name). This is my code:
Private Sub Txtsearch_afterupdate()
Dim Comboval As String
Comboval = Searchby.Value
If Comboval = "Product Code" Then
If Nz(Me.Txtsearch, "") = "" Then
Me.FilterOn = False
Else
Me.Filter = "[product_code] = " & Me.Txtsearch
Me.FilterOn = True
End If
ElseIf Comboval = "Ingredient Name" Then
If Nz(Me.Txtsearch, "") = "" Then
Me.FilterOn = False
Else
Me.Filter = "[product_name] = """ & Me.Txtsearch & """"
Me.FilterOn = True
End If
End If
End Sub
The 'Product Code' bit works fine, but trying to search for an ingredient by name just brings up a blank field. HELP! (please)
Private Sub Txtsearch_afterupdate()
Dim Comboval As String
Comboval = Searchby.Value
If Comboval = "Product Code" Then
If Nz(Me.Txtsearch, "") = "" Then
Me.FilterOn = False
Else
Me.Filter = "[product_code] = " & Me.Txtsearch
Me.FilterOn = True
End If
ElseIf Comboval = "Ingredient Name" Then
If Nz(Me.Txtsearch, "") = "" Then
Me.FilterOn = False
Else
Me.Filter = "[product_name] = """ & Me.Txtsearch & """"
Me.FilterOn = True
End If
End If
End Sub
The 'Product Code' bit works fine, but trying to search for an ingredient by name just brings up a blank field. HELP! (please)