Results 1 to 7 of 7
  1. #1
    SanjaySingh is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jul 2017
    Posts
    1

    VLOOKUP in Access


    I want to put a Vlookup formulae in Access Form. So when i feed a Customer Code in One Field it automatically feed other fields like customer name etc..

  2. #2
    Join Date
    Apr 2017
    Posts
    1,776
    Look for DLookup in help!

  3. #3
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,372
    Seems to me you'd want a form combo box that allows you to choose the customer code from its list. When that happens, you use the AfterUpdate event of the combo to requery the form, which is based on a query that uses the combo box results as criteria. Then the rest of the controls display the data based on the customer code.

    There is no VLookup or HLookup in Access. DLookup can only return data from one field in one record in a table or query. It cannot populate the rest of your form, unless you want to put that function in every control, which would not be the way to go.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Is purpose of this control to input criteria to search for CustomerCode and filter the form? This must be an UNBOUND control and as Micron points out, code would perform this action.

    If purpose of this control is to enter value into a new record and therefore is bound to a field, use combobox with a RowSource that retrieves multiple fields - this is a multi-column combobox. Then textboxes can reference columns of the combobox to display info of the selected item.
    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.

  5. #5
    CodeLiftSleep is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    May 2017
    Posts
    48
    Why not just write VBA to handle the "OnChanged" event to run a SQL Query like
    Code:
    "SELECT * FROM Customers WHERE CUSTOMERCODE  = " & textBox.Value
    and then populate the other fields from the returned recordset?

    Alternatively you could use the TextBox.Value to do a DLookup for the each of the other fields as well.

  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,642
    Another option which avoids extra trips to the table:

    BaldyWeb - Autofill
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    CodeLiftSleep is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    May 2017
    Posts
    48
    Quote Originally Posted by pbaldy View Post
    Another option which avoids extra trips to the table:

    BaldyWeb - Autofill
    He can also download the necessary info to a variant array(s) and then search those instead of the table which would be a lot quicker as well.

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

Similar Threads

  1. Vlookup in Access?
    By Sgligori in forum Forms
    Replies: 5
    Last Post: 05-01-2015, 08:32 AM
  2. VLookup function in Access?
    By mveda2004 in forum Queries
    Replies: 2
    Last Post: 02-25-2013, 09:42 PM
  3. VLookup? in Access 2010
    By Lazor78 in forum Database Design
    Replies: 1
    Last Post: 07-25-2012, 03:34 AM
  4. Vlookup in Access with SQL
    By jogunjobi in forum Queries
    Replies: 1
    Last Post: 01-30-2012, 07:25 PM
  5. Vlookup function in access
    By rici7 in forum Forms
    Replies: 1
    Last Post: 10-16-2010, 04:41 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