Results 1 to 8 of 8
  1. #1
    funkygoorilla is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    93

    Auto Populate two fields

    Hi, question on auto populating.


    I have a form where a user needs to enter a ID number, and I have a table of ID numbers and the Names that they go with. I would like for the user to enter the ID number and in separate fields, the form will display the last name and first name. I dont need the information stored, I am just wanting to use it as a way for the user to verify they typed in the correct ID. Is this done with a query? Or can someone recommend a solution.
    Thanks!
    FunkyG

  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
    Does this help?

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

  3. #3
    apr pillai's Avatar
    apr pillai is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2010
    Location
    Alappuzha, India
    Posts
    209
    You can use two Dlookup() Functions in separate Text Boxes to display FirstName and LastName values from the ID-Table, when the ID value is entered in the Textbox with the name txtID.

    =Dlookup("FirstName","idTable","tblID = " & [txtID])

    =Dlookup("LastName","idTable","tblID = " & [txtID])

  4. #4
    funkygoorilla is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    93
    @Pbaldy
    Hi, thanks for the reply. From my understanding, would the user have to choose from a drop down to get the related info to show? If so, that is not going to work for me, since there would be about 150 options. Is it possible to have the info show after they tab through the field with the ID number?

    FunkyG.

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    With a combo, the user can still type in their choice. They don't have to scroll and select. Besides being able to get the other info more efficiently, the combo does the validation for you, making sure the user enters a valid ID (using the Limit to List property). If want to use a textbox, you can use the less efficient DLookup's to get the related info, and of course you need to validate the entry yourself.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    funkygoorilla is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    93
    Ok, im getting your idea with the combo box, but the information in the combo box needs to be somewhat secure. Its basically an ID number used to validate a users identity. I really cant have the IDs know to the others, then they would be able to match IDs with the names.
    FunkyG

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Makes sense. You can use the DLookup's as apr suggested. If it were me, I'd probably be opening a recordset on the data to validate the input ID anyway, and I'd get the names from that.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    funkygoorilla is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    93
    Hi, thank you both for the help.
    I did get it to work with the following syntax.
    =DLookUp("[First Name]","tblName","[Seniority ID] = Form![SeniorityIDResult]"
    I had to tell Access to look on the current form, hence the Form!, and then the field to look in which is the SeniorityIDResult.


    Appreciate the help, this forum is awesome!
    FunkyG

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

Similar Threads

  1. Replies: 2
    Last Post: 12-07-2010, 12:32 PM
  2. Auto Populate
    By co_sportsguy in forum Access
    Replies: 3
    Last Post: 09-01-2010, 01:22 PM
  3. auto populate mutiple fields
    By jomoan58 in forum Access
    Replies: 1
    Last Post: 07-23-2010, 01:03 PM
  4. Replies: 3
    Last Post: 10-05-2009, 07:22 AM
  5. Auto populate fields on a form
    By ldarley in forum Forms
    Replies: 0
    Last Post: 08-14-2008, 09:39 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