type mismatch on rst.findfirst

Hi -
On my app I need to validate it a certain record exists, before trying to insert a new one. The the existence is determined by a rst.findferst on the rst (a query), that combines two columns.

my code is:

    Dim tblSelecaoDetail_r As DAO.Recordset
    Dim qryMMRfilterNew_rst As DAO.Recordset
    Dim tblSelecaoDetail_rst As DAO.Recordset
    Dim qrySelecaoExistencias_rst As DAO.Recordset
   
    Dim strLocateSelected As String
    Dim lngNumRecords As Long
    Dim strX As String
   
    Set BddPlus = CurrentDb
    Set qryMMRfilterNew_rst = BddPlus.OpenRecordset("qryMMRfilterNew", dbOpenDynaset)
    Set tblSelecaoDetail_rst = BddPlus.OpenRecordset("tblSelecaoDetail", dbOpenDynaset)
    Set qrySelecaoExistencias_rst = BddPlus.OpenRecordset("qrySelecaoExistencias", dbOpenDynaset)

...

   Do While Not qryMMRfilterNew_rst.EOF
        ' acrescentar os registos seleccionados de qryMMRfilterNew à selecção escolhida
        ' mas... se já existe... não inserir!
        strLocateSelected = "existe = '" & Me.frmfld_refSelecao & qryMMRfilterNew_rst!CodMilitante & "'"
        qrySelecaoExistencias_rst.FindFirst strLocateSelected
        If qrySelecaoExistencias_rst.NoMatch = "" Then
            tblSelecaoDetail_rst.AddNew
            tblSelecaoDetail_rst!CodMilitante = qryMMRfilterNew_rst!CodMilitante
            tblSelecaoDetail_rst!refSelecaoMaster = Me.frmfld_refSelecao
            tblSelecaoDetail_rst.Update
            lngNumRecords = lngNumRecords + 1
        End If
        qryMMRfilterNew_rst.MoveNext
    Loop

but I am getting, on the  rst.nomatch statement tye "type mismatch" error

the rst looks OK as well as the search field...

Screen-Shot-2017-10-27-at-11.47.11.png
Screen-Shot-2017-10-27-at-11.47.19.png
can anyone help?
João serras-pereiraAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
NoMatch  returns a boolean (True/False), not a string, so:

  If  qrySelecaoExistencias_rst.NoMatch = True then

Jim.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
João serras-pereiraAuthor Commented:
Thanks!!
now I am posting a related quesiton as it is always returning TRUE but the record is there so it should return FALSE...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.