Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2016
    Posts
    22

    Answered: Frustrating DLookup issue

    Hello all,

    I have a frustrating Dlookup issue that I could not resolve without help. I have code the works only if I check the ID number (a numerical value), but if I check the TeamNumber (which is a string like S7) it fails. Here is the two code sections I am using.

    =DLookUp("[Section]","[TeachingTeams]","ID = " & [Forms]![TeachingCheckout]![TeamNum]) This code works, and returns the values it should.

    =DLookUp("[Section]","[TeachingTeams]","TeamNumber = ' " & [Forms]![TeachingCheckout]![TeamNum] & [']) This code yields a #Name? error.

    I have checked the format a hundred times, and I believe I am using the string concatenation correctly.

    The table it is checking is an Excel document that will change every semester, which is why I am using an excel import instead of a native table. I have attached the screen capture of that table below.

    If I put the two codes in two different fields in my form, one works, one fails. The failure is total, regardless of what is input (whether it is a number like 7, or a string like S7.)

    Any ideas on what I am doing wrong? I have 15 other fields in this form that do work (the other fields are pulling names out of a barcode table, a completely different table than this one).

    Thank you for any advice or help.

    Click image for larger version. 

Name:	Capture.PNG 
Views:	3 
Size:	25.0 KB 
ID:	17234

  2. Best Answer
    Posted by WayCal

    "Remove the brackets around the "'""


  3. #2
    Join Date
    Dec 2013
    Posts
    46
    Provided Answers: 2
    Remove the brackets around the "'"

  4. #3
    Join Date
    Dec 2016
    Posts
    22

    Thank you

    Thank you,
    As an aside, I didn't put the brackets in, but I think Access did because I was typing the commands in Word and copying and pasting. Changed over to notepad++ no so that smart quotes and other special characters wont work their way in and cause mistakes.

    Thank you again. I was going crazy.

Posting Permissions

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