Results 1 to 4 of 4
  1. #1
    noretoc is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2012
    Posts
    18

    dlookup with a contains criteria?

    Hi there,


    Can a Dlookup command search for part of a field rather than the whole thing. EX.
    Dlookup is RecipientX = DLookup("RecipientID", "MasterFeedData", "[Logins]=" & Me!JID)

    Logins field contains CITIGRTS,CITIGRPS,GTORTTRO
    jID input contains CITIGRPS

    Currently dlookup looks for an exact match between Logins and JID. I want to change the Dlookup to look for partial matches in the Logins field if possible.

    Thank for any assistance.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Is Logins field a true multi-value field or just a single text string with comma separators?

    If just a text string, try:

    "Logins LIKE '*" & Me!JID & "*'"

    or

    "InStr([Logins],'" & Me!JID & "'>0"
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    noretoc is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2012
    Posts
    18
    That did it. I don't know SQL well, and though that the criteria was supposed to be formatted like an SQL statement. I didn't realize that a normal VB comparison would work. Thank you very much, this also helps with cratfting these in the future!!

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    The WHERE CONDITION argument does follow SQL syntax, note the apostrophe delimiters. Date values would use #.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 11
    Last Post: 04-30-2012, 07:22 PM
  2. DLOOKUP criteria using variable
    By Thumbs in forum Programming
    Replies: 14
    Last Post: 02-21-2012, 08:08 AM
  3. Multiple criteria in DLookup
    By crowegreg in forum Forms
    Replies: 7
    Last Post: 06-22-2011, 01:47 AM
  4. Replies: 1
    Last Post: 06-17-2011, 12:59 AM
  5. Dlookup to match two criteria and return value
    By randolphoralph in forum Programming
    Replies: 20
    Last Post: 05-20-2010, 12:27 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