rst.nomatch always returns TRUE

I had this question after viewing type mismatch on rst.findfirst.
On my app, I have a rst with a value and I am always getting a .nomatch situation in spite of the record being there (a match occurs)

van anyone help?



Screen-Shot-2017-10-27-at-12.41.28.png

Screen-Shot-2017-10-27-at-12.41.28.png
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.

Pawan KumarDatabase ExpertCommented:
Compare it value with true or false..

IF _rst.NoMatch  = True
...
Else
...
End IF
Gustav BrockCIOCommented:
Adjust your filter:

strLocateSelected = "CodMilitante = '" & qryMMRfilterNew_rst!CodMilitante.Value & "' And refSelecaoMaster = '" & Me!frmfld_refSelecao.Value & "'"

Open in new window

/gustav

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
Dale FyeOwner, Developing Solutions LLCCommented:
You should not have to test for "=True" because the NoMatch property returns a boolean and should not need an "=True" test.

The first thing I would do is print out the criteria string you are using for the FindFirst method; do this right after setting your strLocateSelected value.

debug.print strLocateSelected

Then I would create a query that uses the query you are using for your recordset as its source and add the criteria that was printed in the previous step to the query, to determine whether it actually returns a record.

If not, then rs.nomatch is working properly.
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

João serras-pereiraAuthor Commented:
Hi (Gustav)
Now I am getting a novel error:

Screen-Shot-2017-10-27-at-13.47.05.png
Screen-Shot-2017-10-27-at-13.48.18.png
aikimarkCommented:
in the Immediate window, use "?" instead of "debug.print"
Dale FyeOwner, Developing Solutions LLCCommented:
that particular error explicitly indicates that the [CodMilitante] field does not exist in the recordset that you are using the FindFirst method against.
Gustav BrockCIOCommented:
Yes, that field is missing or misspelled, either in your recordset or in the query.

/gustav
João serras-pereiraAuthor Commented:
righto and thanks!!!!! I had a misspeleld nam as welll... THANKS for helping mme!
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.