Results 1 to 5 of 5
  1. #1
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368

    using like with field names

    Hey all,



    So apparently the "like" operator only seems to enjoy playing with strings.

    i'm trying to get something to the effect of:
    WHERE tbl1.field1 like *tbl2.field2*

    help is appreciated.

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    what's the question shabz? what output are you looking for?

    here's a quick tutorial:

    LIKE "*" & [FIELD] & "*" will yield this: hello world - if the [field] = "llo" OR "world" OR "hello" OR "o wo"

    LIKE *[FIELD] will yield this: hello world - if the [field] = "o world" OR " world"

    make sense? (not sure about the second, didn't test it)

  3. #3
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    confusion on the part where i'm trying to get
    WHERE tbl1.field1 like *tbl2.field2*

    it seems as though the like operator doesnt take field names, only strings. i've tried different concatenations (ex. "*" & tbl.field &"*") but it is still not doing giving me results.

    how do i get it to work?

  4. #4
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by TheShabz View Post
    (ex. "*" & tbl.field &"*") ]
    that should work fine shabz. It works for me.

    but look at what you wrote. the last & and "*" are too close. NO SPACE. that'll throw syntax error or no output.

    I don't think you can do this: [table field]* (I tested it) , but you can do it your way.

  5. #5
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    of course. my coworker decided to play a gag on me and empty the reference table. no wonder i wasnt getting any results. revenge shall be mine.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. IIF In Query that refers to other field names
    By JohnBoy in forum Queries
    Replies: 2
    Last Post: 06-18-2010, 11:41 PM
  2. Verify CSV Field Names Before Importing
    By johnson in forum Import/Export Data
    Replies: 2
    Last Post: 01-26-2010, 06:53 PM
  3. Changing field names in queries
    By scottsoo9 in forum Queries
    Replies: 1
    Last Post: 12-01-2009, 05:47 PM
  4. Replies: 5
    Last Post: 03-31-2009, 09:16 PM
  5. Quick way to stuff field names into text field
    By kfinpgh in forum Programming
    Replies: 0
    Last Post: 01-04-2007, 01:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums