Results 1 to 4 of 4
  1. #1
    aviscomi is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2016
    Posts
    2

    DLookup

    I've used this a million times, but for some reason it now only returns data from the first record in the table no matter what the part_Number is.

    Private Sub Part_Number_LostFocus()
    Dim varIDesc, varIName


    varIName = DLookup("Part_Name", "Item", "[Part_Number] = [Part_Number]")
    varIDesc = DLookup("Part_Description", "Item", "[Part_Number] = [Part_Number]")


    If (Not IsNull(varIName)) Then Me.Part_Category = varIName
    If (Not IsNull(varIDesc)) Then Me.Part_Desc = varIDesc
    End Sub

    Any thoughts?

  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
    See if this helps:

    DLookup Usage Samples
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    aviscomi is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2016
    Posts
    2
    Ugh!...I feel like an idiot!

    Thanks!

  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!
    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. Shortening if / dlookup >0 / then dlookup
    By Jack Russel in forum Modules
    Replies: 1
    Last Post: 02-19-2016, 03:01 PM
  2. Using a DLOOKUP
    By derek7467 in forum Access
    Replies: 9
    Last Post: 02-20-2014, 04:07 PM
  3. You could use (DLookup) instead of (IIf)
    By azhar2006 in forum Queries
    Replies: 7
    Last Post: 02-11-2014, 12:45 PM
  4. Need help with a DLookup using Or
    By jax1000rr in forum Queries
    Replies: 1
    Last Post: 05-06-2013, 11:18 AM
  5. Is DLookUp What I should be using?
    By cameronaziz in forum Forms
    Replies: 2
    Last Post: 03-24-2011, 04:29 PM

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