Results 1 to 4 of 4
  1. #1
    Williams485 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Feb 2013
    Posts
    42

    More than One Record on filtered Continuous Form

    Hello Access Forum,


    I've put together a form [Report Viewer], which is bound to a table [Opportunities], on which there are two combo boxes and a subform [qryTtlRev subform], whose default view is 'continuous form'. I'm trying to use the two combo boxes as controls for users to apply filters to the data that will be showed in the subform. So far, I have only one combo box in play and the desired functionality isn't quite there.

    Currently, my first combo box [cbStageSelect] applies the filter, but instead of all records that meet the filter criteria being displayed, only one record is shown. How can I change this so that ALL records that fit criteria are shown?

    The event code that applies the filter is as follows:

    Code:
    Private Sub cbStageSelect_AfterUpdate()
        If cbStageSelect = "ALL" Then
            DoCmd.ShowAllRecords
        Else
            DoCmd.GoToControl "qryTtlRev subform"
            Forms![Report Viewer]![cbStageSelect].SetFocus
            DoCmd.ApplyFilter , "Stage='" & Me!cbStageSelect.Value & "'"
        End If
    End Sub

  2. #2
    Rawb is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    You need to use the Subform's Filter Property, not the Application's ApplyFilter Method. Try using this instead:
    Code:
    Private Sub cbStageSelect_AfterUpdate()
        If cbStageSelect = "ALL" Then
            Forms![Report Viewer]![cbStageSelect].FilterOn = False
        Else
            Forms![Report Viewer]![cbStageSelect].Filter = "Stage='" & Me!cbStageSelect.Value & "'"
            Forms![Report Viewer]![cbStageSelect].FilterOn = True
        End If
    End Sub

  3. #3
    Williams485 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Feb 2013
    Posts
    42
    Thanks, Rawb. I used your code but needed to modify it a little:

    Code:
    Private Sub cbStageSelect_AfterUpdate()
        If cbStageSelect = "ALL" Or cbStageSelect = "" Then
            Forms![Report Viewer]![qryTtlRev subform].Form.FilterOn = False
        Else
            Forms![Report Viewer]![qryTtlRev subform].Form.Filter = "Stage='" & Me!cbStageSelect.Value & "'"
            Forms![Report Viewer]![qryTtlRev subform].Form.FilterOn = True
        End If
    End Sub
    However, I still don't get all records showing - even when 'ALL' is selected and the filter is off.

  4. #4
    Williams485 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Feb 2013
    Posts
    42
    I appear to have solved this issue. The subform had both 'Link Master Fields' and 'Link Child Fields' properties set to the primary key in the table. I removed this (without any knowledge of why this might work, if I'm honest!) and my form now performs as I want it to.

    Any comments on why my solution is in fact the solution would be welcomed!

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

Similar Threads

  1. Replies: 3
    Last Post: 10-12-2012, 01:38 PM
  2. Delete continuous form record
    By tylerg11 in forum Forms
    Replies: 3
    Last Post: 03-09-2012, 03:00 PM
  3. Hiding a new record in a continuous form
    By system243trd in forum Forms
    Replies: 3
    Last Post: 12-03-2011, 01:04 AM
  4. Get position of record in continuous form
    By Whizbang in forum Forms
    Replies: 3
    Last Post: 11-02-2011, 01:47 PM
  5. Replies: 1
    Last Post: 07-30-2011, 03:21 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