Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Turning Filter On/Off (A2K)

    I enter a number which I want to find a matching record ( or records) for.

    I click on a Command Button called cmdFilter which performs the following:


    Private Sub cmdFilter_Click()
    Dim strWhere As String
    Dim lngLen As Long
    Const conJetDate = "#mm/dd/yyyy#"

    If Not IsNull(Me.txtFilterVendor) Then
    strWhere = strWhere & "([WB_LVendor] Like ""*" & Me.txtFilterVendor & "*"") AND "
    End If
    '
    If Not IsNull(Me.txtFilterVendorSp) Then
    strWhere = strWhere & "([WB_LVendor] = """ & Me.txtFilterVendorSp & """) AND "
    End If
    End Sub


    This works very nicely and finds the appropriate record(s)


    After reviewing said records, I then
    Click on a Command Button called cmdReset which attempts to perform the following:

    Private Sub cmdReset_Click()
    Dim ctl As Control
    For Each ctl In Me.Section(acHeader).Controls
    Select Case ctl.ControlType
    Case acTextBox, acComboBox
    ctl.Value = Null
    Case acCheckBox
    ctl.Value = False
    End Select
    Next
    Me.FilterOn = False
    End Sub

    This is where I get:

    You can
    Cheers,
    Andy

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Turning Filter On/Off (A2K)

    The error message you get has nothing to do with turning filters on or off. The line that is highlighted when the error occurs tries to set the value of a control to Null, and the line that turns the filter off is further down.
    The error message means that one of the text boxes or combo boxes is locked or calculated, so that you cannot change its value.

    BTW, the procedure cmdFilter_Click doesn't do anything, as far as I can tell, so I suppose you didn't post the complete code. But the code is irrelevant to your question.

  3. #3
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Turning Filter On/Off (A2K)

    Hans,

    Thanks as always for the quick and accurate reply. I discovered that some idiot left a combo box in a restricted area ( where my unbound boxes are sitting in the header ).

    And yes, I didn
    Cheers,
    Andy

Posting Permissions

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