Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2004
    Posts
    3

    Unanswered: "Like" wit dlookup

    can someone tell me how to use "like" with Dlookup?

    i have a table "data" with a field "drawing description". A form has a text field call "input".

    i want use this as a vailiation rule such as:

    DLookUp("[input]","Data"," [drawing description] = 'Like "*" & Forms![myform]![input] "*"' ") Is Null

    any suggestions on how to get this working.

  2. #2
    Join Date
    Sep 2001
    Location
    Chicago, Illinois, USA
    Posts
    601
    DLookUp("[input]","Data"," [drawing description] = 'Like "*" & Forms![myform]![input] "*"' ") Is Null

    Not sure what your Is Null is for, but the sytax of your DLookUp should be:

    Code:
    
    DLookUp("[input]","Data"," [drawing description] = "Like '*" & Forms![myform]![input] & "*'")
    

    Ken

    Maverick Software Design

    (847) 864-3600 x2

  3. #3
    Join Date
    Apr 2004
    Posts
    3

    Dlookup with "Like"

    I appreciate the suggestion but there is still something not quite right with the formula below.

    DLookUp("[Text1]","Data"," [drawing description] = "Like '*" & Forms![myform]![Text1] & "*'")

    I've tried moving the quotes around, used single quotes, etc.
    Here's some examples that I tried and the error's I got back

    =DLookUp("[Text1]","Data","[Drawing Description]=Like '*" & [Forms]![myform]![Text1] & "*' ") There is a(n) 'Syntax Error (missing opertor) in the query expression '[Drawing Description]=Like *safsd*'"

    =DLookUp("[Text1]","Data","[Drawing Description]='Like '*" & [Forms]![myform]![Text1] & "*'' ") no error but it won't do anything just hangs there

    =DLookUp("[Text1]","Data","[Drawing Description]='*" & [Forms]![myform]![Text1] & "*' ") no error but doesn't work

    =DLookUp("[Text1]","Data","[Drawing Description]=" Like '*" & [Forms]![myform]![Text1] & "*') no error but doesn't work

    =DLookUp("[Text1]","Data","[Drawing Description]=" Like '*" & [Forms]![myform]![Text1] & "*'") Invalid string

    =DLookUp("[Text1]","Data","[Drawing Description]="Like '*" & [Forms]![myform]![Text1] & "*'" ") Invalid syntax error


    Could it be that the Dlookup does not like "Like"?
    Do you have anyother suggestions?

    Thanks
    Dave

  4. #4
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Just a thought (without trying it) but do you need an = and a Like operator. I also think that there may be too many " included ie try

    DLookUp("[input]","Data"," [drawing description] Like '*" & Forms![myform]![input] & "*' ")

    Apologies if this is of beam


    MTB

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •