Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Aug 2003
    Location
    Stroud, United Kingdom
    Posts
    548
    Thanks
    0
    Thanked 0 Times in 0 Posts

    remove filter (97)

    Hi, i have a form that opnes another form and conditionally sets a filter:

    Private Sub cmdSearch_Click()
    DoCmd.Close acForm, "frm_docidlookup"
    If IsNull(dep) = False Then
    DoCmd.OpenForm "frm_UpdateAll", , , "[Protcode] = '" & dep & "'"
    Else
    DoCmd.OpenForm "frm_UpdateAll"
    End If
    End Sub

    this works fine.

    on the form that is opened i have a combobox that can be used to change the records viewed. If the form opens with no filter this works fine.

    If the form is opened with the filter on however, the combo box whilst displaying the other records, no longer changes them. I know i have to remove the filter first, but am unsure how best to do this.

    should i use the .ShowAllRecords method? I can't find an event to attach it to that doesnt cause problems.

    i want to do something like

    sub when combobox is changed ()
    dim a as string
    a = combobox.value
    If [filter is on] then [remove filter]
    combobox.value = a
    end sub

    any ideas?
    Thanks,

    pmatz

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

    Re: remove filter (97)

    To remove the filter, you can use Me.FilterOn = False, but I don't understand the purpose of

    a = combobox.value
    ...
    combobox.value = a

    <img src=/S/scratch.gif border=0 alt=scratch width=25 height=29>

  3. #3
    4 Star Lounger
    Join Date
    Aug 2003
    Location
    Stroud, United Kingdom
    Posts
    548
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: remove filter (97)

    Ah, thanx Hans.

    I was doing that value thingy because some of the events i tried attaching code to would 'reset' the combox...

    like, showallrecords, it would revert the combobox back to the 1st record.
    Thanks,

    pmatz

Posting Permissions

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