DLookup using Like and Wildcard finding a partial string (from table) contained in fi

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • masterm
    New Member
    • Apr 2013
    • 1

    #1

    DLookup using Like and Wildcard finding a partial string (from table) contained in fi

    i am trying to assign a client name to a record based on like. i want to find the client name from clients table where the partial name from the client table is contained somewhere within the field on a form. i've tried to move my quotes all around also tried single quotes but can't seem to have success. any help would be greatly appreciated!

    Me.FieldName = DLookup("[ClientName]","Clients" ,"*" & "[ClientPartial]" & "* Like " & Forms!FormName! FieldName)
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Your request is a little confusing to me and I honestly do not see the Logic in it. That being said, you would have to:
    1. Check each [ClientPartial] Value in the Clients Table to see if it is contained withing the Form Field.
    2. If a [ClientPartial] is contained within the Form Field, do a subsequent DLookup() to extract the actual Client Name.
    3. This approach is hardly foolproof, however.

    Comment

    • Rabbit
      Recognized Expert MVP
      • Jan 2007
      • 12517

      #3
      Also, it is the right side of the like operator that uses wildcards. And strings need to be surrounded by quotes, you haven't done that. And also you are most definitely referencing ClientPartial incorrectly. I don't know where in your database it is but all I know is you're referencing it as a literal string and that's not going to do what you want it to do.

      Comment

      Working...