Results 1 to 6 of 6
  1. #1
    crimedog is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    141

    Subform - to be filtered by Year Combo Box and then Month Combo Box

    I have a Form - Based on Rep Name.
    Under that is a Subform Based on Sales
    The Rep Name is the first filter for Subform, Then there is a ComboBox on the Subform Based on Year (this is next filter)


    And lastly, there is a ComboBox on Subform Based on Month - this is the last filter.

    I have it working for Rep + Year, but when I Change the ComdoBox Month - It asks again for year (even though it is selected int he original comboBox Year)

    Tried to upload Example, but the size was too big...

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    Did you run Compact & Repair then zip the file? 2mb zip file allowed. If still too large, can upload to fileshare site such as Box.com and post link to file. Identify form involved.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    crimedog is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    141
    Here is the file
    Attached Files Attached Files

  4. #4
    crimedog is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    141
    Okay - I have gotten rid of the error message and set the comboboxes to update correctly (with correct syntax)
    Code:
    froms!Maiform!Subform1.form.RecordSource
    Now I need the Subform to filter based on Cbo Month & Cbo Year

    See attached (zipped file)

    I am guessing it is simple fix.
    Attached Files Attached Files

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    Do you want both criteria to be required or do you want to allow one or the other alone?

    Suggest you change TabOrder for each combobox so CboYear is 0 and CboMonth is 1.

    If you want to require both criteria, consider:

    Set CboMonth Enabled property to No.


    Private Sub CboYear_GotFocus()
    Me.FilterOn = False
    Me.CboMonth.Enabled = False
    End Sub

    Private Sub CboYear_AfterUpdate()
    Me.CboMonth.Requery
    Me.CboMonth.Enabled = True
    End Sub

    Private Sub CboMonth_AfterUpdate()
    Me.Filter = "[OrderYear]=" & Me.CboYear & " AND [OrderMonth]=" & Me.CboMonth
    Me.FilterOn = True
    End Sub
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    crimedog is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    141
    Great! Works just like I had imagined it should

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

Similar Threads

  1. Search Form with Combo Box - Filtered
    By Varda in forum Forms
    Replies: 6
    Last Post: 06-14-2013, 07:24 PM
  2. Replies: 14
    Last Post: 05-08-2013, 03:08 PM
  3. Replies: 33
    Last Post: 01-13-2012, 07:44 AM
  4. Month/Year lookup for combo box
    By Buakaw in forum Forms
    Replies: 7
    Last Post: 03-01-2011, 09:49 PM
  5. Replies: 5
    Last Post: 01-02-2011, 10:09 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