Search in a table with "findfirst" method

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alinagoo
    New Member
    • Apr 2010
    • 53

    #1

    Search in a table with "findfirst" method

    Hi all & The best wishes for you

    I want to search in a table with "findfirst" method upon tow variables,val and val2, but findfirst can not find any record with the match criteria and "NoMatch" property shows true when search become finished however the match record exists in the table!
    this is the criteria expression:
    Code:
    SearchSTR = "[Pack_no]= ' " & val & " ' And [Item_no]= ' " & val2 & " ' "
    Val is a string variable and Val2 is a numeric variable

    Please help me
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    These things are always confusing to me, so I keep some exemplars. This should work if the info supplied is correct.
    Code:
    SearchSTR = "[Pack_no]= '" & Val & "' And [Item_no]= " & val2
    Linq ;0)>

    Comment

    • alinagoo
      New Member
      • Apr 2010
      • 53

      #3
      Great!
      Thanks So.It worked correctly.
      Who knows a complete reference to specify criteria strings in VBA?

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32669

        #4
        Try Quotes (') and Double-Quotes (") - Where and When to use them.

        Comment

        • alinagoo
          New Member
          • Apr 2010
          • 53

          #5
          Thanks So.Looks Good!
          I'll read it.
          Bye

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32669

            #6
            I hope it helps you :)

            Welcome to Bytes!

            Comment

            Working...