Results 1 to 10 of 10
  1. #1
    Join Date
    May 2009
    Location
    Crete, Greece
    Posts
    90

    Unanswered: Form will not filter

    My main input form does not show the filter buttons on the toolbar. When I try to manually add the 'filter by form' button, it shows on the toolbar but is shaded - disabled. In the properties part of the form, 'Allow filters' is set to 'yes'. Can anyone give me an idea what is going on here?! Many thanks.

  2. #2
    Join Date
    Jun 2009
    Posts
    4

    RE: Form will not filter

    Select you main form in the navigation window and open in design view. Righ click on the square in the forms upper left corner and open the forms properites. Select the All tab and make sure Allow Filters is set to Yes.

  3. #3
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    She did say that AllowFilters was set to yes.

    It's not an unbound form is it?

    I don't know what would disable filtering like that, besides the already stated Allow Filters thing. It will be interesting to find out
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  4. #4
    Join Date
    May 2009
    Location
    Crete, Greece
    Posts
    90
    It's a form bound to a query. Looking at them again, all my forms are the same - filter disabled. However, if I make a new form, the filters are enabled. 'Allow Filters' is set to yes. It DOES have an ActiveX calender control on it, which I haven't used before so perhaps this is the culprit, but my other forms do not have the calendar so then again, perhaps not.

    I have cut and pasted different bits of code to power this form, no doubt it is very messy but it works (well, apart from filtering). Here is the code.

    -----------------------------------

    Option Compare Database
    Option Explicit
    Dim cboOriginator As ComboBox


    Private Sub Text21_AfterUpdate()

    End Sub

    Private Sub Text21_BeforeUpdate(Cancel As Integer)

    End Sub

    Private Sub Text21_Click()

    End Sub

    Private Sub Received_AfterUpdate()

    End Sub

    Private Sub Received_Click()

    End Sub

    Private Sub ReceivedDate_BeforeUpdate(Cancel As Integer)

    End Sub

    Private Sub ReceivedDate_Click()

    End Sub

    Private Sub ArrivalDate_BeforeUpdate(Cancel As Integer)

    End Sub

    Private Sub ArrivalDate_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Set cboOriginator = ArrivalDate
    ocxCalendar.Visible = True
    ocxCalendar.SetFocus
    If Not IsNull(ArrivalDate) Then
    ocxCalendar.Value = cboOriginator.Value
    Else
    ocxCalendar.Value = Date
    End If
    End Sub

    Sub CboMoveTo_AfterUpdate()
    Dim rs As DAO.Recordset

    If Not IsNull(Me.cboMoveTo) Then
    'Save before move.
    If Me.Dirty Then
    Me.Dirty = False
    End If
    'Search in the clone set.
    Set rs = Me.RecordsetClone
    rs.FindFirst "[ID] = " & Me.cboMoveTo
    If rs.NoMatch Then
    MsgBox "Not found: filtered?"
    Else
    'Display the found record in the form.
    Me.Bookmark = rs.Bookmark
    End If
    Set rs = Nothing
    End If
    End Sub


    Private Sub DepartureDate_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    ' Note which combo box called the calendar
    Set cboOriginator = DepartureDate
    ' Unhide the calendar and give it the focus
    ocxCalendar.Visible = True
    ocxCalendar.SetFocus
    ' Match calendar date to existing date if present or today's date
    If Not IsNull(cboOriginator) Then
    ocxCalendar.Value = cboOriginator.Value
    Else
    ocxCalendar.Value = Date
    End If
    End Sub


    Private Sub RoomingListDate_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    ' Note which combo box called the calendar
    Set cboOriginator = RoomingListDate
    ' Unhide the calendar and give it the focus
    ocxCalendar.Visible = True
    ocxCalendar.SetFocus
    ' Match calendar date to existing date if present or today's date
    If Not IsNull(RoomingListDate) Then
    ocxCalendar.Value = cboOriginator.Value
    Else
    ocxCalendar.Value = Date
    End If
    End Sub


    Private Sub ocxCalendar_Click()
    ' Copy chosen date from calendar to originating combo box
    cboOriginator.Value = ocxCalendar.Value
    ' Return the focus to the combo box and hide the calendar and
    cboOriginator.SetFocus
    ocxCalendar.Visible = False
    Set cboOriginator = Nothing
    End Sub

    Private Sub ocxCalendar_Updated(Code As Integer)

    End Sub
    ---------------------------------------

    Any suggestions would be very gratefully received!

    Lisa

  5. #5
    Join Date
    Feb 2004
    Posts
    40
    Lisa,

    i'm used to doing this in another way ( i think ).

    On the form ( continous form ) a create a controls ( text field or dorpdown box ) and two buttons.
    In the 'start filter' button code i do something like :
    Code:
      me.filter = "[somefield]='" & me.control & "'"
      me.filteron = true
      FilterOutButton.visible = true
    The FilterOutButton does something like :

    Code:
     me.control = ""
     me.StartFilterButton.setfocus
     me.filteron = false
     me.FilterOutButton.visible=false
    Regards
    Erwin
    Bye Erwin

  6. #6
    Join Date
    May 2009
    Location
    Crete, Greece
    Posts
    90
    I think I might have to try that next Erwin. Thanks again.

  7. #7
    Join Date
    May 2009
    Location
    Crete, Greece
    Posts
    90

    This is just silly...

    My form will not filter. It also will not delete records from the toolbar. When I put the custom buttons on the toolbar, they show 'disabled'. Sorry to raise this again, but does anyone have any idea what's going on with it?

  8. #8
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    I don't at the moment, but I can tell you that I am curious as to learn what might cause this rather frustrating issue.

    What version of Access are you using?

    If you change your RecordSource for the form to something basic, like a local table, do the filtering commands become "ungreyed" ?

    Which specific buttons on the toolbar are greyed?
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  9. #9
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Personally I avoid using the filter and instead change the recordsource to reflect the criteria (ie. = Forms!MyForm!MySearchField on my key search field). I've had too many issues using the filter option. It's prone to problems when filtering on fields which may have odd syntax such as ' and " in the data and is slower when dealing with large recordsets.

    It's good for simple forms though based on 1 table and simple or no subforms.
    Last edited by pkstormy; 06-18-09 at 22:57.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  10. #10
    Join Date
    May 2009
    Location
    Crete, Greece
    Posts
    90
    Well, thanks to Erwin (etsoft) we have the answer, and personally I think it's bizarre.

    The form, when set to 'Allow PopUps = Yes', disabled all these buttons. I re-set the form to not allow popups and it's absolutely fine.

    Thanks to everyone who contributed, and special thanks to Erwin for the use of his mighty brain.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •