none
Dropdown RRS feed

  • Question

  • What is the best way to create a dropdown list in a split form that on the bottom half of the display, shows a specific query result?
    Tuesday, August 29, 2017 3:12 PM

All replies

  • Not sure I understand. Do you want to use a combo box (dropdown) to filter records on a form? If that's what you want create a regular form with the recordsource you need. Make sure the control wizard is turned on and put a combo box in the form's header. The wizard will walk you through setting up the filter based on the selection in the combo box.

    Bill Mosca
    www.thatlldoit.com
    http://tech.groups.yahoo.com/group/MS_Access_Professionals

    Tuesday, August 29, 2017 7:19 PM
  • And if you do as Bill said, the datasheet portion of a Split Form should automatically only display the records matching the selected item on the combobox/dropdown.
    Tuesday, August 29, 2017 7:24 PM
  • Okay so what Im making is a network hardware inventory database for my company. We have multiple locations. What id like to do is some how organize the different types of network hardware (servers,switches,printers) into a form based off there location.

    So I have 3 different tables. One that hold the different hardware information (IP, Mac address,ect), locations, and hardware type (server,switch,printer). I have various queries that filters out all the printers at a certain locatoin. or a query that shows all printers.  does that make more sense?

    Wednesday, August 30, 2017 4:21 PM
  • So, it sounds like you want to use a specific query based on what the user wants to see on the form. If so, this is not necessary because you can simply filter the form just like how you filtered each query to only display a specific set of data from your tables.

    Hope it helps...

    Wednesday, August 30, 2017 4:36 PM
  • I guess im unsure how to do that. any other recommendations how how to create my form?
    Wednesday, September 6, 2017 2:14 PM
  • Okay, for example, let's say you have the following query, which will display all hardware types in all locations:

    SELECT HW_TYPE.ID, HW_TYPE, IP, MAC, LOCATION
    FROM TYPE_TBL
    INNER JOIN HW_TBL
    INNER JOIN LOCA_TBL
    ON LOCA_TBL.ID=HW_TBL.LOCA_ID
    ON TYPE_TBL.ID=HW_TBL.TYPE_ID

    Now, let's say we use this query as a source of our form, which then displays all hardware types in all locations on our form.

    You can add a dropdown on this form showing all the hardware types. For example:

    SELECT ID, HW_TYPE FROM TYPE_TBL

    In the AfterUpdate event of the combobox, you can try something like:

    Me.Filter = "ID=" & Me.ComboboxName
    Me.FilterOn = True

    Hope it helps...

    Wednesday, September 6, 2017 2:37 PM
  • Okay Thanks Ill give that a try.
    Wednesday, September 6, 2017 2:49 PM
  • You're welcome. Let us know how it goes...
    Wednesday, September 6, 2017 2:52 PM
  • Im sorry for all the dumb questions. I am not by any means an Access expert. So just to verify. I have all my queries.I create a new blank for and then I add a combo box to the form. Should I then right click on the "unbound" combo box and right click and select "expression builder and use the code that you have mentioned above?
    Wednesday, September 6, 2017 3:00 PM
  • Hi mwieting,

    I think you need to make the form support to create a module at first.

    Change to Design View and set the Has Module property to true.


    Then You could right click the combo box and select properties.

    Then you could refer to below picture to open the VBE and then you could edit code.

    By the way, I think you'd better create the form based on the query. Since the code is filtering data of the form, it could not work when there is no data in the form.

    Best Regards,

    Terry

    Thursday, September 7, 2017 9:44 AM
  • Hi. As Terry said, my instructions were to create a query and then create a form based on that query before creating the combo box. Then, on the combo box, I said to use the AfterUpdate event. That means in Design View, select the combo box and go to the Properties window and select the After Update property from the Events tab. Then, click on the drop down arrow and select [Event Procedure]. You then click on the three dots (ellipsis)next to it to open the VBA window and enter the code I gave you but make sure to use your own object names like the actual name of your field and combo box. Hope it helps...
    Thursday, September 7, 2017 2:42 PM