Results 1 to 4 of 4
  1. #1
    coyrob2010 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    4

    Form field to auto pull data from a table when there is a match

    I have built a nice database that has a form to enter data which logs in product received, there is a combo box on the same form that is linked through the query builder to auto populate the names from the contacts info table (the receivers of the product received) the contacts info table also contains information that is specific to each name such as locations. As of now I have created a command button that brings me to the form that shows the information fields I need specific to a name, once I get that I have another command button to bring me back to the main form. I am asking for some help to create an additional list box on the main data entry form so as when the name is entered the new list box or text box (which is best?) will auto populate the information I need on one form instead of going back and forth.

    Example:

    Requester Name [ auto populate name ] currently linked to contacts info table (working)

    (New field) Preferred Location [ need to auto populate location ] from the contacts info table (how do you pull locations specific to a contact name from the same table?



    Thank you in advance.

    Rob

  2. #2
    Amerlitong is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Feb 2013
    Posts
    10
    i would prefer to use listbox...
    then try to put this SQL statement in your listbox recordsource properties...

    SELECT location FROM contacts_info WHERE name = combobox

    and create an On Click event in your combobox properties then select the event procedure and click the ...(three doted button)

    type this code

    Me.listbox.requery

    i hope this will help...

    Cheers

  3. #3
    coyrob2010 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    4
    Hi,

    Is the On Click event in the combo box properties done in the [Requester Name] combo box? I tried this and as soon as I tabbed out of the requester name field the visual basic window opened displaying the code Me.listbox.requery.

    Thanks again in advance.

    Rob

  4. #4
    Amerlitong is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Feb 2013
    Posts
    10
    Quote Originally Posted by coyrob2010 View Post
    Hi,

    Is the On Click event in the combo box properties done in the [Requester Name] combo box? I tried this and as soon as I tabbed out of the requester name field the visual basic window opened displaying the code Me.listbox.requery.

    Thanks again in advance.

    Rob
    Thats right...create a Click event in your [Requester Name] combo box...and put this code Me.Listbox.requery


    In your New Listbox recordsoure properties...type this SQL statement


    SELECT location FROM contacts_info WHERE name = [Requester Name]

    location,name fields and contacts_info table is just my assumption...it may defer into your actual database...

    Cheers...

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

Similar Threads

  1. Replies: 7
    Last Post: 04-22-2012, 02:28 PM
  2. Replies: 5
    Last Post: 03-01-2012, 12:59 AM
  3. Replies: 1
    Last Post: 12-21-2011, 02:11 PM
  4. Replies: 3
    Last Post: 10-13-2011, 04:42 PM
  5. pull up data from a table into a form
    By MattD00 in forum Forms
    Replies: 1
    Last Post: 03-30-2011, 08:15 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