Results 1 to 7 of 7
  1. #1
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727

    dlookup error

    all, using access 2013. I am trying to use a dlookup:


    Code:
    =DLookUp("[Cost]","tblpricing","[cust_id] = " & [sfrmApprdPrice].[Form]![cust_id])
    I am getting: #error
    I checked all my spelling and the fields both on the form and in the table and I can't figure out why I'm getting this error.

    I am using a similar dlookup on the same form and it works:=
    Code:
    DLookUp("[SS]","tblScale","[FTE] = " & [sfrmApprdPrice].[Form]![FTE])
    Can anyone help me please. Thanks

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    If the data type of cust_id is text, you'd need delimiters.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    cust_id is text. delimiters???

  4. #4
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    Ok. I modified the code:
    Code:
    =DLookUp("[Cost]","tblpricing","[cust_id] =' " & [sfrmApprdPrice].[Form]![cust_id] & "'")
    Now; I don't get anything and I know the field is not blank.

  5. #5
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    Is the Cust_Id a text value? Your reference to the form control doesn't look right if I've deciphered the design. More like Forms![Order Details]!ProductID

    If you're doing this in code, debug.print the criteria result in the immediate window and see what you get (?[sfrmApprdPrice].[Form]![cust_id])
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Take the space out from between the quotes.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    This may be simpler and would be more efficient if appropriate:

    http://www.baldyweb.com/Autofill.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 2
    Last Post: 01-04-2016, 09:40 AM
  2. DLookup error
    By Nadine67 in forum Access
    Replies: 12
    Last Post: 07-14-2015, 02:51 PM
  3. DLOOKUP #Error
    By neo651 in forum Forms
    Replies: 6
    Last Post: 12-12-2012, 12:54 PM
  4. Error in Dlookup?
    By cindytan in forum Forms
    Replies: 1
    Last Post: 02-07-2012, 02:40 AM
  5. DLookup error
    By jgelpi16 in forum Programming
    Replies: 3
    Last Post: 08-25-2010, 07:26 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