Results 1 to 4 of 4
  1. #1
    molly13 is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    4

    dlookup on query


    Hi,

    I have the following DLookup as a field in a query, where "Phone Number" is a field in the "Employee Phone Numbers" table, as is [Employee ID]. [ID] is a field in the [EmployeeQuery] that I created (short text). I want to pull up Employees phone numbers based on their ID (i.e., Row 5's Employee ID in the query signals what the row's phone number field should be, based on the Phone Number query), but when I try to view the results, I get a popup that says "Enter Parameter Value" for "EmployeeQuery!ID"

    DLookUp("[Phone Number]","Employee Phone Numbers","[Employee ID]='" & [EmployeeQuery]![ID] & "'")

    I am very new with Access, and have not done DLookUps before. Could someone please help alert me as to what I am doing wrong?

    Thank you very much!!

  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
    Well, probably

    DLookUp("[Phone Number]","Employee Phone Numbers","[Employee ID]='" & [ID] & "'")

    but it would be far more efficient to join the phone number table into this query.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    molly13 is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    4
    That solved it - thank you very much!

    And I tried doing that originally, but I must have messed something up, because all of my rows got duplicated by 35 (the number of phone numbers that I have entered).

    Thanks again!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help and welcome to the site by the way! If all of your rows got duplicated by the number of records in the second table, you didn't have a join between the tables. In design view, that would be represented by a line between the appropriate fields in each table (the same fields as in your DLookup() criteria).
    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. Need help on Dlookup within query
    By cp1981 in forum Queries
    Replies: 9
    Last Post: 07-25-2014, 01:57 AM
  2. DLookup Query
    By Pure Salt in forum Access
    Replies: 5
    Last Post: 06-13-2014, 02:35 AM
  3. Dlookup in query
    By Bertrand82 in forum Queries
    Replies: 9
    Last Post: 11-14-2012, 06:42 AM
  4. DLookup in Query
    By mfrey40 in forum Queries
    Replies: 3
    Last Post: 12-27-2011, 12:41 AM
  5. Query with Dlookup
    By mari_hitz in forum Queries
    Replies: 5
    Last Post: 10-14-2011, 09:22 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