Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2009

    Question Unanswered: How to populate a text box with data from another database?

    Hi, this question relates to forms in Access 2007. I hope I explained this clearly, and I can provide any additional information as necessary, thank you in advance for taking a look!

    My Access database is linked to an SQL database via External Data/ODBC Database. The social security number and person's name are stored in the table "dbo_EBase" in the linked database. I'm trying to create a form that allows a user to type a social security number in a text box and have the corresponding person's first and last name (from the linked database) populate in two other text boxes right away in the same form. The last name and first name do not have to be added to the table in Access, just displayed as view only on the form.

    So far, I have this partially working by using a DLookUp in the Control Source for the person's last name.

    dbo_EBase = table in linked database with Social Security Numbers, Names
    EbLastName = field containing last name in dbo_EBase table
    EbSocNumber = field containing Social Security Number in dbo_EBase table
    FSA_Entry_Update_Form = form in Access that I'm working on
    SocialSecurity# = text box in FSA_Entry_Update_Form that the user types in the social security number
    LastNameDLOOKUP = text box in FSA_Entry_Update_Form that I want to auto-populate based on the Social Security Number entered in SocialSecurity# text box on same form

    Here's the code in the Control Source for the LastNameDLOOKUP text box:

    This code populates the correct last name for the social security number entered in each record, BUT it doesn't do it right away. It only enters the corresponding name after I click all of the way back to the first record using the navigation buttons on the form. I tried adding the same code above into various places in the Event tab (On Click, Before Update, After Update, On Dirty, On Change, On Got Focus, etc...) but I get the same result.

    Is it possible to have the corresponding name populate right after the social security number is entered, and the user clicks out of the social security number text box?

    Thanks a lot for any assistance!

  2. #2
    Join Date
    May 2005
    Nevada, USA
    Provided Answers: 6
    Rather than a textbox, use a combo box that has both the SSN and name, then your last name textbox is:


    where x is the column containing the name (and it's zero based).

  3. #3
    Join Date
    Aug 2009
    Thanks for the quick response, it was very helpful!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts