Results 1 to 8 of 8
  1. #1
    buffaloguy is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    3

    Dlookup error $name?

    I am struggling with a simple dlookup as a form control source. Here is the setup.


    Table :Enroll_gradenames
    Fields: grade_name, dgrdisplay_order,
    Form: enrollmentsub (This form is a subform of form named enrollment which is on a tab control of a form called teacherresources
    Control name on from which has value:enroll_desc

    I have tried the following which results in the #Name? error

    =DLookUp([Enroll_gradeNames]![dgrdisplay_order],[enroll_gradeNames],"[ [grade_name] ='" & [enroll_desc] & "'")

    I have used blookup before with success. Any troubleshooting tips are greatly appreciated.
    Last edited by buffaloguy; 01-17-2019 at 08:59 AM. Reason: Senior moment

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722

  3. #3
    buffaloguy is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    3
    Senior moment. Yes, it is dlookup. I will edit my post. I have it right in the db. Thanks

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    I believe you'll find that

    [Enroll_gradeNames]![dgrdisplay_order]

    should simply be

    "dgrdisplay_order"

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  5. #5
    buffaloguy is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    3
    Same error. Here is the new string.....=DLookUp("dgrdisplay_order",[enroll_gradeNames]," [grade_name] ='" & [enroll_desc] & "'")

  6. #6
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    Try =DLookUp("dgrdisplay_order","[enroll_gradeNames]","[grade_name] ='" & [enroll_desc] & "'") (added double quotes around table name)

  7. #7
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Gicu is correct...and you really don't need the square brackets around the Field names, since you don't have spaces in them, using the Underscore, instead.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  8. #8
    accesstos's Avatar
    accesstos is offline Expert
    Windows XP Access 2007
    Join Date
    Dec 2018
    Location
    Greece
    Posts
    551
    Give it a try in this way:
    Code:
    =DLookUp("dgrdisplay_order","Enroll_gradeNames","grade_name ='" & [Forms]![teacherresources]![enrollment]![enroll_desc] & "'")
    Set correctly the path of the form in which the control "enroll_desc" belongs.

    Good luck!

    John

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

Similar Threads

  1. Replies: 1
    Last Post: 07-26-2016, 06:34 AM
  2. Replies: 6
    Last Post: 03-17-2016, 02:10 PM
  3. Replies: 3
    Last Post: 01-23-2014, 07:49 AM
  4. Replies: 0
    Last Post: 07-16-2012, 05:42 AM
  5. Replies: 6
    Last Post: 05-30-2012, 12:32 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