Switchboard Search help

oxicottin

Learning by pecking away....
Local time
Today, 10:57
Joined
Jun 26, 2007
Messages
873
Hello, I’m using a search in my switchboard
and everything works great but, when I type in a number lets say 1.00 then I get no records found (But there are records) then if I type in 1.19 then it brings up a record that have this number. What I’m saying is it wont find numbers that are like 1.00 2.00 3.00 but it will find numbers if the 00 was like 17 or 12 ect. (example 4.17) What am I doing wrong in my code for the search for it to be doing this? PurchaseCost and Price are the ones doing this. Thanks!
Code:
Private Sub cmdSearch_Click()
If IsNull(Me.txtSearch) Then
      'show all records
      DoCmd.OpenForm "frmRBackyardMain"
   Else
      On Error Resume Next
      'filter for keyword
      DoCmd.OpenForm "frmRBackyardMain", , , "[Season] Like '*" & Me.txtSearch & "*' " _
          & " OR [Vendor] Like '*" & Me.txtSearch & "*' " _
          & " OR [Description] Like '*" & Me.txtSearch & "*' " _
          & " OR [Z554] Like '*" & Me.txtSearch & "*' " _
          & " OR [OrderNumber] Like '*" & Me.txtSearch & "*' " _
          & " OR [PurchaseCost] Like '*" & Me.txtSearch & "*' " _
          & " OR [Price] Like '*" & Me.txtSearch & "*' "
       End If
    
End Sub
 
do you mean to put the filter on a table instead of the FORM?
 
Everything works fine except when I do a search using a whole number like 1.00 or 2.00 or 3.00 then my search resolts come up with no records when there are records. If I use 1.10 or 2.10 ect. something other than .00 then it finds the results. The two fields that do it are "Price" and "PurchaseCost"
I tried to use:
Code:
"OR Format([PurchaseCost],""0.00"") Like '*" & Me.txtSearch & "*' "
But I get an Compile Error: Expected: list separator or)
and it outlines the 0.00. Any sugestions? Thanks!
 
I posted this question on Microsoft Discussion group and it got answered quickly (As usual) by John Spencer and followed up by Douglas Steele.....

Code:
& " OR Format([PurchaseCost],""0.00"") Like '*" & Me.txtSearch & "*' " _
          & " OR Format([Price],""0.00"") Like '*" & Me.txtSearch & "*' "
 

Users who are viewing this thread

Back
Top Bottom