Fail to autoupdate list on filter change

C.D

Registered User.
Local time
Today, 15:16
Joined
Sep 29, 2007
Messages
42
Hello, tried to search the forum for a matching problem, but It's difficult to get exact results..

I'm working on a filter for my form, which is based on a list.
I've made an option group to filter the list based on status..
The only problem is that I have to manually update the form for the filter to take effect.

Code:
Private Sub optStatusFilter_AfterUpdate()
    Dim strFill As String
    Dim opt As OptionGroup
        Set opt = Me.optStatusFilter
        
        If opt = 1 Then
            strFill = ""
        ElseIf opt = 2 Then
            strFill = "1"
        ElseIf opt = 3 Then
            strFill = "2"
        ElseIf opt = 4 Then
            strFill = "3"
        End If
    
    Me.txtOptionResult = strFill
End Sub
This fills a textbox with the desired ID.

I've tried putting in Me.SearchList.Requery in txtOptionResult on change/dirty but I still have to uypdate manually.
 
I have to manually update the form for the filter to take effect...

I've tried putting in Me.SearchList.Requery in txtOptionResult on change/dirty but I still have to uypdate manually.

I'm confused by these statements! Are you tryingto update the form or your SearchList? The form would simply be Me.Update.
 
Hi, thanks for replying.
I'm indeed trying to update the searchlist. As I change my selection in the option group, so does txtOptionResult, but I fail to make the filter of the searchlist update as the value in the textbox changes. And I must update the form manually for the filter to take effect
 
Hi, thanks for replying.
I'm indeed trying to update the searchlist. As I change my selection in the option group, so does txtOptionResult, but I fail to make the filter of the searchlist update as the value in the textbox changes. And I must update the form manually for the filter to take effect

Hey C.D.,

You are saying "list", is that in a ListBox or Continuous Form, something else? Also, it doesn't appear that you are providing all of your code, unless I'm overlooking something, cause I can't see where your telling the list to filter according to the criteria in txtOptionResult. A little more information may help others help you.

Shane
 
Hey C.D.,

You are saying "list", is that in a ListBox or Continuous Form, something else? Also, it doesn't appear that you are providing all of your code, unless I'm overlooking something, cause I can't see where your telling the list to filter according to the criteria in txtOptionResult. A little more information may help others help you.

Shane

Hey, ShaneMan, thanks for replying. I'll try to post some more info.

The list is a standard list, and it's the basis of my form. In the rowsource of the list, I've got these:


Code:
Like "*" & [Forms]![frmAnimeFansubber_Updater]![Search2] & "*"
to search for names.

Code:
Like "*" & [Forms]![frmAnimeFansubber_Updater]![txtOptionResult] & "*"
to filter based on status.

Listbox:
Code:
Private Sub SearchList_AfterUpdate()
    Dim db As DAO.Database
    Dim rs As DAO.Recordset
      
    Set rs = Me.Recordset.Clone
    rs.FindFirst "[AnimefansubberID] = " & Str(Me![SearchList])
    Me.Bookmark = rs.Bookmark
End Sub

Option group:
Code:
Private Sub optStatusFilter_AfterUpdate()
    Dim strFill As String
    Dim opt As OptionGroup
        Set opt = Me.optStatusFilter
        
        If opt = 1 Then
            strFill = ""
        ElseIf opt = 2 Then
            strFill = "2"
        ElseIf opt = 3 Then
            strFill = "3"
        ElseIf opt = 4 Then
            strFill = "4"
        End If
    
    Me.txtOptionResult = strFill
End Sub


I've tried these, but neither work:
Code:
Private Sub txtOptionResult_Change()
Me.SearchList.Requery
End Sub

Private Sub txtOptionResult_Dirty(Cancel As Integer)
Me.SearchList.Requery
End Sub


Searching works, however, and the list updates for each letter I add/remove to the search string, by using two textboxes.
Code:
Private Sub Search_Change()
Dim SearchString As String

 SearchString = Search.Text
 Search2.Value = SearchString
 Me.SearchList.Requery
End Sub

Basically, the selection I make on the option group, displays the given StatusID in the txtOptionResult, which filters the list.
 
Hey C.D.,

I'll admit that I'm somewhat confused on how your filtering but I'll take a stab at what I think your trying to do. This may not work but try adding this in the option groups AfterUpdate event:

Code:
Private Sub optStatusFilter_AfterUpdate()
    Dim strFill As String
    Dim opt As OptionGroup
        Set opt = Me.optStatusFilter
        
        If opt = 1 Then
            strFill = ""
        ElseIf opt = 2 Then
            strFill = "2"
        ElseIf opt = 3 Then
            strFill = "3"
        ElseIf opt = 4 Then
            strFill = "4"
        End If
    
    Me.txtOptionResult = strFill
    [COLOR="Red"]Me.SearchList.Requery[/COLOR]
End Sub

Like I said I'm not too sure what all is going on with your filtering but let's give it a try.

Shane
 
Hey C.D.,

I'll admit that I'm somewhat confused on how your filtering but I'll take a stab at what I think your trying to do. This may not work but try adding this in the option groups AfterUpdate event:

Code:
Private Sub optStatusFilter_AfterUpdate()
    Dim strFill As String
    Dim opt As OptionGroup
        Set opt = Me.optStatusFilter
        
        If opt = 1 Then
            strFill = ""
        ElseIf opt = 2 Then
            strFill = "2"
        ElseIf opt = 3 Then
            strFill = "3"
        ElseIf opt = 4 Then
            strFill = "4"
        End If
    
    Me.txtOptionResult = strFill
    [COLOR="Red"]Me.SearchList.Requery[/COLOR]
End Sub

Like I said I'm not too sure what all is going on with your filtering but let's give it a try.

Shane

Thanks alot ShaneMan, that worked perfectly!
I failed in some logical aspects there, as I thought about having the list requery as the textbox content changes - as with the search-textbox I'm using. Turns out that only works when you input something in the textbox.
I knew it had to be an easy solution to this matter - atleast I learned a great lesson :)

The main goal with my DB is to keep records over my anime. Track which episodes I've got from different series and from which fansub group. The way anime is distributed, the vast number of fansubbers and the great numbers of series getting pumped out, makes this DB etremely handy. Still some work needed though, but it's in active use and functions are added when and where I see it fit.


Again, thanks alot! :)
 
Your welcome. Glad I could help and that you got over a hurdle. By experience, there will be more hurdles. :)

Shane
 

Users who are viewing this thread

Back
Top Bottom