Results 1 to 3 of 3
  1. #1
    Kirsti is offline Competent Performer
    Windows 7 32bit Access 2003
    Join Date
    Jan 2012
    Location
    New Zealand
    Posts
    172

    DLookUP Help Needed

    Hi, I am trying to get my DLookUp to work, and can't for the life of me.

    Here's what I have (which isn't working):

    strWebAddress = DLookup("[URL]", "Complex_Photos", "[Complex_BE] = Forms![OpeningForm]![Text37]" And "[Document_Purpose]", "Complex_Photos" = 'SiteAerialHO'")

    It works until I put the And clause in, and then I'm getting a syntax error.

    Any suggestions much appreciated.

    Thanks,
    Kirsti

  2. #2
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    You have quote marks in the wrong place. I don't quite see the comparison you want to make following the AND, so I'm guessing, but try this

    strWebAddress = DLookup("[URL]", "Complex_Photos", "[Complex_BE] = '" & Forms![OpeningForm]![Text37] & "' And [Document_Purpose] = 'SiteAerialHO'")

    That assumes [Complex_BE] is text and encloses the value from the form in single quotes; if it is numeric, then try this:

    strWebAddress = DLookup("[URL]", "Complex_Photos", "[Complex_BE] = " & Forms![OpeningForm]![Text37] & " And [Document_Purpose] = 'SiteAerialHO'")

    John

  3. #3
    Kirsti is offline Competent Performer
    Windows 7 32bit Access 2003
    Join Date
    Jan 2012
    Location
    New Zealand
    Posts
    172
    Perfect - thanks John!!

    Complex_BE is numeric, and your second example worked perfectly!

    Thanks again,

    Kirsti

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

Similar Threads

  1. *URGENT HELP NEEDED* DLookUp Formula
    By iProRyan in forum Forms
    Replies: 1
    Last Post: 03-28-2012, 11:55 AM
  2. Dlookup help needed
    By mkb_cma in forum Access
    Replies: 12
    Last Post: 11-28-2011, 11:37 PM
  3. Help Needed
    By sdecaire in forum Access
    Replies: 2
    Last Post: 11-11-2011, 03:07 PM
  4. Help Needed
    By vkmarty in forum Access
    Replies: 1
    Last Post: 09-23-2011, 07:23 AM
  5. Help needed
    By longbo43 in forum Access
    Replies: 3
    Last Post: 09-27-2010, 10:18 AM

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