Results 1 to 4 of 4
  1. #1
    Angate is offline Novice
    Windows 7 Access 2007
    Join Date
    Apr 2010
    Posts
    5

    [Resolved] Filter my form from combo box

    Sorry If this has been posted before, I was unable to find it.

    I have a form that contains applications, each application assigned to a department via departmentID. I would like to have a combobox at the top of the form that is populated with all of the departments, and when it is changed, it filters the form to only show applications from that department.



    Is this something I do with controls and properties, or do I need to put together some VBA?
    Last edited by Angate; 04-24-2010 at 01:43 PM. Reason: Resolved

  2. #2
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    As I understand, you want a combobox to be populated by a set of department names. and when a department is selected, have a subform to display your results relevant to only that department. Since you didn't mention your experience with Access, I'll assume youre a novice.

    Here's the non-vba way to do it (well, one little vba section). VBA will be cleaner and give you more options but I am nowhere near proficient enough to guide you through that one. maybe someone else (probably Maximus) can provide.

    the combobox:
    1. create a combobox with the wizard
    2. "i want the combo box to look..."
    3. choose your table/query
    4. choose your field
    5. hit next until you can hit finish
    6. rename the combobox (NOT its label) as something relelvant. we'll call it cmbDept for now.

    subform:
    1. create a query that will display your results.
    2. in the criteria for department (the same you chose as the control source for the combo box) type "Forms!myForm!cmbDept" replacing myForm with your form's name.
    3. create a subform using the wizard and use the query you just made as its source

    back to the combobox:
    1. open the properties dialog box for the combobox
    2. on the even tab find After Update
    3. click the ellipses (...) to open the vba window
    4. type in Me.Requery (press enter) Me.Refresh
    5. save and close the VBA window

    Now cross your fingers and hope it works because this was all off the top of my head.

  3. #3
    Angate is offline Novice
    Windows 7 Access 2007
    Join Date
    Apr 2010
    Posts
    5
    You sir, are my hero. It all makes perfect sense, I just didn't know what vba to use to do the refresh I guess.

  4. #4
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    No problem. I'm glad it makes sense. The question is, does it work? If so, please mark the thread solved so others can make use of this.

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

Similar Threads

  1. Combo box and filter query
    By thart21 in forum Forms
    Replies: 7
    Last Post: 04-06-2010, 11:37 AM
  2. Filter by combo box & text box?
    By sparkyboy2406 in forum Forms
    Replies: 2
    Last Post: 02-24-2010, 04:20 PM
  3. filter form based on combo box
    By lloyddobler in forum Forms
    Replies: 8
    Last Post: 09-10-2009, 07:33 AM
  4. Combo Box Filter
    By jgelpi in forum Programming
    Replies: 3
    Last Post: 07-27-2009, 12:54 PM
  5. Filter Form records with Combo Box????
    By jgelpi in forum Forms
    Replies: 0
    Last Post: 05-19-2009, 07:05 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