Results 1 to 4 of 4
  1. #1
    mermaidboy is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2015
    Posts
    13

    Can't make a Dlookup work - please help !

    I have a form called InventoryDetailForm with a control called SupplierID. The record source for the Form is a query called PriceListQuery. I also have another table called SupplierAccountTable, in which there is a field called Discount%, as well as a related SupplierID field. I want to display this field on the form - hence:

    =DLookUp("[Discount%]","SupplierAccountTable","[SupplierID]=" & [SupplierAccountTable]![SupplierID])

    I don't want to add the SupplierAccountTable to the main PriceListQuery as then I cannot edit the records, which is why I am messing around with dlookup.

    Any help welcome...



    Thanks,

    N

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    The parameter must reference a field in the form RecordSource. Makes no sense to reference the SupplierAccountTable field.

    =DLookUp("[Discount%]","SupplierAccountTable","[SupplierID]=" & [fieldname])

    Advise not to use punctuation/special characters (underscore only exception) in names. Better would be DiscountPct.
    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
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    If you use a combo for supplier this would be more efficient:

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

  4. #4
    mermaidboy is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2015
    Posts
    13
    Thanks - got it.

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

Similar Threads

  1. DLookup won't work
    By Paul H in forum Access
    Replies: 5
    Last Post: 12-09-2016, 10:26 AM
  2. Cannot get DLookUp to work with concatenated criteria
    By sportyaccordy in forum Queries
    Replies: 7
    Last Post: 07-21-2016, 09:12 AM
  3. Can't get my Dlookup to work!
    By Maxelkat in forum Forms
    Replies: 3
    Last Post: 05-19-2011, 06:00 AM
  4. Would DLookup() work better here?
    By eww in forum Programming
    Replies: 2
    Last Post: 09-30-2010, 01:53 PM
  5. Replies: 1
    Last Post: 01-10-2006, 12:32 PM

Tags for this Thread

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