Results 1 to 2 of 2
  1. #1
    denners05 is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Jun 2011
    Posts
    1

    DLookup help

    I am new to access and am trying to use a dlookup macro. I am trying to pull the field Unit Price from a table called Products Where am i going wrong with this code.

    DLookUp("UnitPrice","Products","ProductID = " & [ProductID])

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,921
    Are you referencing a control (text or combo box) on form to get ProductID criteria? Is this control bound?
    If ProductID is a text field, need apostrophe delimiters. Does the field UnitPrice have a space as shown in your question or no space as shown in the DLookup?

    DLookUp("UnitPrice","Products","ProductID = '" & Me.ProductID & "'")

    DLookUp("[Unit Price]","Products","ProductID = '" & Me.ProductID & "'")
    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. DLookUp Help
    By ThaGreenMoose in forum Forms
    Replies: 10
    Last Post: 06-15-2011, 12:08 PM
  2. DLookup
    By neil45156 in forum Forms
    Replies: 1
    Last Post: 04-11-2011, 11:31 AM
  3. Is DLookUp What I should be using?
    By cameronaziz in forum Forms
    Replies: 2
    Last Post: 03-24-2011, 04:29 PM
  4. DLookup Help
    By Alex Motilal in forum Queries
    Replies: 3
    Last Post: 01-17-2011, 02:01 PM
  5. Dlookup??
    By Vikki in forum Access
    Replies: 4
    Last Post: 02-16-2010, 07:59 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