Results 1 to 3 of 3
  1. #1
    oakhoplite is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Apr 2018
    Posts
    9

    Question DLookUp text box

    Hello!


    I have tried to create a text box that retrieves a name from a table based on what the user types into another text box.

    For example, the user types in their first name into a text box called txtFirstName. Another textbox below it returns their surname using a DLookUp function (which searches in the Users table for a surname corresponding to the firstname previously typed in by the user):

    =DLookUp("Surname"; "Users"; "FirstName=[Forms]![frmUser]![txtFirstName])

    I have tried the function but it is not working (I may not know how to specify that the firstname entered by the user should be the same as the one in the table). I have also tried:

    =DLookUp("Surname"; "Users"; "Firstname=" & [Forms]![frmUser]![Firstname])

    However, neither works. Can anyone see what I did wrong? And does anyone know another alternative? Help would be greatly appreaciated!

  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,518
    This should help with the DLookup():

    DLookup Usage Samples

    though this may be more efficient if appropriate:

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

  3. #3
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    What surname are you expecting if 2 users have the same 1st name?

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

Similar Threads

  1. DLookup Using Text Fields
    By 2stew in forum Queries
    Replies: 10
    Last Post: 12-13-2017, 05:46 PM
  2. Replies: 9
    Last Post: 04-18-2014, 08:51 PM
  3. Can I use a DLOOKUP inside of a text box?
    By Access_Novice in forum Forms
    Replies: 5
    Last Post: 01-26-2014, 03:56 PM
  4. DLookup as ControlSource for a text box?
    By GraeagleBill in forum Forms
    Replies: 4
    Last Post: 03-29-2013, 05:09 PM
  5. DLookup with Text
    By Kirsti in forum Programming
    Replies: 8
    Last Post: 06-26-2012, 07:56 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