Results 1 to 3 of 3
  1. #1
    Marco Soares is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2015
    Posts
    5

    Combo Box to Select Row from other Table and to make it Autocomplete

    Hello

    Thank you very much for willing to help. I'm having a problem with many Combo Boxes. It's something like this:

    Imagine i have a table called "TblBook" and that one of its fields ia called AUTHORS and it's a foreign key to a table called "TblAuthor". The primary key of "TblAuthor" is an autonumerated field called Author_ID. The other field of this table is called Author_Name.

    Now imagine i create a Query to Join these 2 tables by matching Author_ID with AUTHOR. Then i create a Form based on this Query, so that i can use it to add new books..

    Now i create a Combo Box in this form to get a row from TblAuthor. The Combo Box's record source is the field AUTHOR and its row source is something like:
    SELECT [Author].[Author_ID], [Author].[Author_Name] FROM Author.

    When i select a row from the drop box of the combo box, the Combo Box control shows the Author_ID value from the row i selected. The Author_Name Control is automatically filled.

    This works right, but i need to make it faster to select rows from other tables with Combo boxes. What i need to know is:

    1) How can i create a combo box that stores not the Author_ID, but the Author_Name instead? An Author_ID Control of the Form should be filled automatically after i select the row.

    2) How can i make this Combo Box autocomplete for each keystroke i give?



    Thank you very very much for the atention and for willing to help!

    Best Regards,
    Marco

  2. #2
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    1) How can i create a combo box that stores not the Author_ID, but the Author_Name instead? An Author_ID Control of the Form should be filled automatically after i select the row.
    In a multi-field combo box, the bound column is the one that 'stores' the value. You choose this column from the control property sheet. As I recall, the column index is 1 based, not zero. The first left-most column that is visible is the one that is displayed in the control. So the source of the combo has to return the field you want to see, and it has to be the bound column to auto complete, as I recall.

    2) How can i make this Combo Box autocomplete for each keystroke i give?
    That is the default behaviour if the control has a row source, but it applies to the bound column. So your combo bound column usually has to be a text field, unless you want to auto complete by numbers. Here's more info on the subject, and I recall that it has a means to do this with text boxes too, but it involves code. By the time you read this, I will likely not be able to reply further in a reasonable time frame.


    http://allenbrowne.com/AppFindAsUType.html
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    Marco Soares is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2015
    Posts
    5
    Micron

    Thank you very much for your reply! Actually someone from other forum solved my problem just before i read your message. I just read an article about cross-posting in forums. It made me feel really stupid! I didn't know all the people helping in these forums were volunteers. My behaviour was abusive and i sincerely apologize. I'm really sorry for taking your time. I will behave apropriately from now on. Thank you.

    Best Regards,
    Marco

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

Similar Threads

  1. Open form make combo box select year
    By Ruegen in forum Forms
    Replies: 12
    Last Post: 03-27-2014, 10:32 PM
  2. Replies: 18
    Last Post: 04-22-2012, 11:39 AM
  3. Replies: 1
    Last Post: 04-18-2012, 07:38 AM
  4. how to make autocomplete field from history
    By tushargsm in forum Forms
    Replies: 1
    Last Post: 01-18-2012, 09:51 AM
  5. Combo-Box Filter/Autocomplete Question
    By jhcarrell in forum Forms
    Replies: 4
    Last Post: 11-02-2010, 12:46 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