none
Error Message When Applying a Filter to an ADO Recordset - Arguments are of the wrong type, RRS feed

  • Question

  • Hi there,

    Could you please help me with this problem? I got the VBA error message: " Arguments are of the wrong type are out of acceptable range, or are in conflict with one another.", when run to the statement :  rs.Filter = "t0.mtype NOT Like 'SE*'".

    Thank you in advance!

    from

    Yulanhua

    ''------------

    Public Function Func1() As Boolean

    Dim rs As New ADODB.Recordset
     Dim strsql As String

     Set rs = New ADODB.Recordset

     strsql = "select t0.mtype, t0.customer from Table0 t0"
          
     rs.Open strsql, gConn

     rs.Filter = "t0.mtype NOT Like 'SE*'"

    MsgBox ("No. of filterd records:" & rs.RecordCount)

    errhand:
        StocktoQAListing = False
        MsgBox Err.Description
    End Function

    Monday, December 21, 2015 2:24 AM

Answers

  • Hi yulanhua,

    Based on my test and research, the NOT key word can’t be used in the filter, I suggest that you could use it in the SQL script directly.

    Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, December 22, 2015 5:41 AM
    Moderator

All replies

  • Hi yulanhua,

    Based on my test and research, the NOT key word can’t be used in the filter, I suggest that you could use it in the SQL script directly.

    Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, December 22, 2015 5:41 AM
    Moderator
  • Hi Starain, Thank you very much for providing the solution. It's resolved by using your suggestion. Thanks again.

    Yulanhua

    Wednesday, December 23, 2015 12:54 AM
  • Hi Yulanhua,

    You’re welcome, please mark it answer to close this thread.

    Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, December 23, 2015 2:21 AM
    Moderator