Filter Combo box and Option Group

argel

Registered User.
Local time
Today, 12:58
Joined
Feb 7, 2019
Messages
29
Hi ! I have two types of filters: one is with combo box and the other with option group. If I select the option on the option group box and then the option in the combo box, the filter works fine. However, if I choose the combo box first, the filter in the option group opens a pop up window asking for introduce the option.Even though I write the option, the filter doesn´t work. Any thoughts ?

The code for the combo box and option group are the following :

===============================================



Code:
Private Sub cc_deq_combo_box_AfterUpdate()
'Code Tags Added by Uncle Gizmo
    Dim CC_DEQ As String
    
    CC_DEQ = " SELECT LISTA_EQ.ID, LISTA_EQ.[No INV], LISTA_EQ.DESCRICAO, LISTA_EQ.MARCA, LISTA_EQ.MODELO, LISTA_EQ.[Num_SERIE / MATRICULA] " _
    & " FROM LISTA_EQ " _
    & " WHERE ([CC_DEQ] = " & Me.cc_deq_combo_box & ") " _
    & " ORDER BY [No INV] "

    Me.subInfoResults.Form.RecordSource = CC_DEQ
    Me.subInfoResults.Form.Requery

End Sub


===============================================

Private Sub status_box_Click()
    
    Dim strFilter As String

    Select Case [status_box]

        Case 1
        
            strFilter = "[STATUS] = 'AV'"
            Forms!SEARCH.subInfoResults.Form.Filter = strFilter
            Forms!SEARCH.subInfoResults.Form.FilterOn = True
           
            
        Case 2
            strFilter = "[STATUS] = 'SV'"
            Forms!SEARCH.subInfoResults.Form.Filter = strFilter
            Forms!SEARCH.subInfoResults.Form.FilterOn = True
           
            
        Case 3
            strFilter = "[STATUS] = 'PQ'"
            Forms!SEARCH.subInfoResults.Form.Filter = strFilter
            Forms!SEARCH.subInfoResults.Form.FilterOn = True
            

        Case 4
            strFilter = "[STATUS] = 'ABATE'"
            Forms!SEARCH.subInfoResults.Form.Filter = strFilter
            Forms!SEARCH.subInfoResults.Form.FilterOn = True
            

        Case 5
            strFilter = "[STATUS] = '?'"
            Forms!SEARCH.subInfoResults.Form.Filter = strFilter
            Forms!SEARCH.subInfoResults.Form.FilterOn = True
            

    End Select

End Sub
 
Last edited by a moderator:
Could it be that your SQL Statement does not include [STATUS] ?
 
What Uncle G is saying is that your recordsource doesn't appear to include the field [Status] , so filtering by it is unlikely to work.
 
What Uncle G is saying is that your recordsource doesn't appear to include the field [Status] , so filtering by it is unlikely to work.

I don't want status to appear on the list, only filter by. If I first filter by status everything works fine, but chosing other filter first it gives me error message.


P.S. I can't see links or images because I've not reached the 10 posts yet
 
Just because you included it in the SELECT statement doesn't mean it has to appear. But you do have to have it in your underlying data to be able to filter by it.
 
Just because you included it in the SELECT statement doesn't mean it has to appear. But you do have to have it in your underlying data to be able to filter by it.


Thank you so much! Problem solved!
 

Users who are viewing this thread

Back
Top Bottom