Results 1 to 13 of 13
  1. #1
    Lily21 is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    May 2021
    Location
    Canada, Montreal
    Posts
    21

    Select an item from a drop-down list and view details about the item

    Hello,

    I would like to know how to view details in relation to an item selected from a drop down list.

    Thanks for your help


  2. #2
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,035
    Hi Lili, there are different possibilities. I presume the items in your list come from a table. Most combo boxes row sources have two columns: the ID that's hidden (column width = 0) and the description that is shown. You can add several columns to the row source and show these in the drop down list. However, once an item is shown only the content of the first column where column width > 0 will be shown. If you need to show the extra information on the form you can create a few extra unbound columns to your form and set the control source to [name Combobox]!Columns(x) where x is the column number (based on a count from 0) you want to show.
    Or you can use the DLookup function as a control source for an unbound text box.

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    you will need some code, but not enough information provided to provide a specific solution

    assuming your combo is called cboCustomers and contains an id to the items listed (such as customerID, customerName) and does not have a value in the controlsource and is the bound column is customerID and you want to view the details in the same form the combo is on and that form has a recordsource of tblCustomers then perhaps in the change event of the combobox would be something like

    me.filter="customerID=" & me.cboCustomers
    me.filteron=true

    so a lot of assumptions about what you might have

  4. #4
    Lily21 is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    May 2021
    Location
    Canada, Montreal
    Posts
    21
    Yes sorry i didn’t give a lot of information, the things is I want like that user can double click on the selected item and maybe like a table or a form will pop up with the informations about this selected item.
    Thank you

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    Perhaps you could mock up a sample or show us some real data. Or post a copy of your database with instructions to highlight the issue/opportunity.

  6. #6
    Lily21 is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    May 2021
    Location
    Canada, Montreal
    Posts
    21
    Open the table (item_reserved) when you double click on one item in a drop list, so the only item selected will show up with all the information that is in item_reserved table

  7. #7
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,557
    Hi Lily

    If you can upload a zipped copy of your current database so we can look at your tables it would help.
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  8. #8
    Join Date
    Apr 2017
    Posts
    1,673
    Create a form (single or continuous) based on your table, with controls linked to table fields;
    Place your combo (unbound) into form header. Add an OnSelection event to combo, which locates the record in form where table field matches with combo's bound column value;
    Add an Current event to form, which sets combo bound column equal to matching form field value.

    When you make a new selection for your combo (the combo value, i.e. bound value, not value displayed), the matching record is displayed or activated in form. When you select another record in form, the combo displays the value matching with active row of form.

    When this isn't what you want, please give a better explanation!

  9. #9
    apr pillai's Avatar
    apr pillai is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    May 2010
    Location
    Alappuzha, India
    Posts
    209
    1. Create an Unbound Combobox (name it as cboID) with the required Columns of data with the related ID as the first column value on the Header Section of the Main Form.
    2. Create a Sub-Form separately with the Detail data and don't forget to include the ID Field as well.
    3. Drag and Drop the Sub-Form on the Detail Section of the Main Form.
    4. Click on the outer Border of the Sub-Form and display the Property Sheet.
    5. Set the Link Master Field Property with the value cboID
    6. Set the Link Child Field Property with the Value ID or whatever the Key field Name in your table but the value should match with the value in the Combobox first column.
    7. Save the Main Form with the sub-form.
    8. Open the Main Form and select an item from the Combobox, you will see the related record details appear on the sub-form.

  10. #10
    Lily21 is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    May 2021
    Location
    Canada, Montreal
    Posts
    21
    Quote Originally Posted by apr pillai View Post
    1. Create an Unbound Combobox (name it as cboID) with the required Columns of data with the related ID as the first column value on the Header Section of the Main Form.
    2. Create a Sub-Form separately with the Detail data and don't forget to include the ID Field as well.
    3. Drag and Drop the Sub-Form on the Detail Section of the Main Form.
    4. Click on the outer Border of the Sub-Form and display the Property Sheet.
    5. Set the Link Master Field Property with the value cboID
    6. Set the Link Child Field Property with the Value ID or whatever the Key field Name in your table but the value should match with the value in the Combobox first column.
    7. Save the Main Form with the sub-form.
    8. Open the Main Form and select an item from the Combobox, you will see the related record details appear on the sub-form.
    Thank you this is exactly what i want to do. I hunderstand all the step except the first one, why do I need to put the combo list in the header of my form?
    Can you give me an example ?

  11. #11
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,557
    Hi Lily
    If you upload a zipped copy of the database we can give you an example
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  12. #12
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    why do I need to put the combo list in the header of my form?
    You typically put controls for navigation or form filtering in the header or footer because the detail section is reserved for things that change as you move from record to record. If your main form has no recordsource, then there is no 'danger' that anything you place in the detail section is going to move around (unless your form height doesn't fit within the form or application window). It's just common practice though because you don't want such controls scrolling up or down out of view.
    Last edited by Micron; 06-07-2021 at 11:48 AM. Reason: clarification
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  13. #13
    Lily21 is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    May 2021
    Location
    Canada, Montreal
    Posts
    21
    Thank you so much everyone it worked !!! 😁

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

Similar Threads

  1. Replies: 7
    Last Post: 11-29-2015, 07:24 AM
  2. Combo Box Won't Select Last Item in List
    By Autumn227 in forum Forms
    Replies: 9
    Last Post: 12-18-2013, 02:37 PM
  3. Replies: 8
    Last Post: 05-25-2013, 05:24 PM
  4. Can't alays select an item from a list box
    By bomber in forum Access
    Replies: 0
    Last Post: 10-16-2009, 10:01 AM
  5. Replies: 8
    Last Post: 09-24-2009, 02:56 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