Results 1 to 4 of 4
  1. #1
    benghee is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Jan 2017
    Posts
    2

    Combo selection in Main Form to display result in Subform

    I have 2 combo boxes retrieve same source from one query in Main form. When user made a selection in Combo box 1 then Combo box 2, it will then search and match the criteria and load the result from the particular query into subform.



    For example, I have 50 products listed in the query. A user selects Color in Combo box 1 then Size in Combo box 2, it will then update the subform to display the result in which product match the criteria of color and size. Do I need to add an Update command button or just use the After Update macros to do it? What are the coding to generate this? Many thanks for the help.

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    The query should read the form items just fine. All you need do is run the query,docmd.openQuery "qsMyQuery"

    the query will look like:
    select * from table where size= forms!myForm!cboSize and color= forms!myForm!cboColor

    or
    are you wanting to update all items in a list TO the size and color?

  3. #3
    benghee is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Jan 2017
    Posts
    2
    No, I do not want to update the query in color and size, just display it will be fine.

    I'm not familiar any coding in VB, is there any easy way I can run the query in Macro builder? I select the combo box 1 as After Update > Macro Builder > OpenQuery > ApplyFilter.... I repeat again to combo box 2 as same commands, but whenever I choose the drop down in combo box, it open the query and pop out the input box for me to enter value of Color.

  4. #4
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    If your query is set up correctly to reference the combo boxes as ranman has said then in the macro builder you can do:

    after update event > RunMenuCommand > refresh.

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

Similar Threads

  1. Replies: 1
    Last Post: 03-02-2016, 08:04 AM
  2. Replies: 6
    Last Post: 02-23-2016, 01:45 PM
  3. Display subtotal from subform in main form
    By dougdrex in forum Forms
    Replies: 5
    Last Post: 11-12-2014, 03:25 PM
  4. How to display multiple Subform in main form
    By selvakumar.arc in forum Forms
    Replies: 5
    Last Post: 05-06-2013, 11:42 AM
  5. Subform won't display in main form
    By Lynn in forum Forms
    Replies: 15
    Last Post: 03-22-2010, 10:17 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