Results 1 to 5 of 5
  1. #1
    ljsincla is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Sep 2018
    Posts
    6

    DLookup syntax error

    Hello, I need a bit of help writing the correct DLookup code. Trying to use two tables.


    1. POAgenda
    2. BuyerList

    I would like to assign the Buyers Name to the PO Agenda table by using DLookup.
    My POAgenda has the following columns and column names pulled from a query to apply the DLookup function.

    RECORD ASSIGNED
    A81
    A20
    B21

    My BuyerList has the following columns and information
    QUE BUYER
    A81 A81: JOHN DOE
    A20 A20: WONDER WOMAN
    B21 B21: SUPER BUYER

    My code is as follows: ASSIGNED: DLookUp("BUYER","BuyerList","QUE = " & [RECORD]")

    I am receiving the following #error in the ASSIGNED field in my POAgenda table where I am trying to put the buyers name.
    Any help to get this code correct will be greatly appreciated

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    RECORD is a text field. Need apostrophe delimiters.
    "QUE='" & [RECORD] & "'"

    Domain aggregate function is least efficient method. Better to join tables or reference columns of combobox.

    Should not save name to POAgenda table.

    Why does the Buyer field show the QUE text?
    Last edited by June7; 09-09-2018 at 07:27 PM.
    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
    ljsincla is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Sep 2018
    Posts
    6
    Wow, thank you very much that syntax worked.

    The Buyer field shows the QUE text because thats the current format my boss is using at the job in Excell. I am trying to build a database in Access to perform the manual tasks that we are doing on the job. Adding the Buyers name right now takes me up to 30 minutes and VLookup did not work supposedly. But I am trying to use Access to do it all and reduce the time for the task. Thanks again for your help.

  4. #4
    ljsincla is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Sep 2018
    Posts
    6
    Another request, after I made the changes to the syntax it worked as required. However, when I changed my query to an Update Query I received the following error.

    ! '
    DLookUp("BUYER","BuyerList",
    "QUE='" & [RECORD] & "'")' is not a valid name. Make sure that it does not include invalid characters or punctuation and that it is not too long.


    Any idea why I would get this error.

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    Already advised you should not save buyer name to data.
    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: 3
    Last Post: 08-17-2018, 07:56 AM
  2. Replies: 2
    Last Post: 01-04-2016, 09:40 AM
  3. Syntax Error in DLookUp
    By nick404 in forum Programming
    Replies: 7
    Last Post: 07-13-2015, 02:41 PM
  4. DLookup Syntax Error
    By uncletreetrunk in forum Programming
    Replies: 4
    Last Post: 07-30-2012, 02:29 PM
  5. Incomplete Syntax Clause (syntax error)
    By ajetrumpet in forum Programming
    Replies: 4
    Last Post: 09-11-2010, 10:47 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