How to find NoMatch?

  • Thread starter Ana via AccessMonster.com
  • Start date
A

Ana via AccessMonster.com

Hello!
Please tell me how to cover NoMatch cases when I use command SEEK? In one
book they say I can use rst.NoMatch, but in VBA I don't get that option and
he doesn't recognize it. Please, tell me how to cover cases where access
don't find anything with Seek?
Thanks!
Ana
 
D

Dale_Fye via AccessMonster.com

When using Seek, the recordsets EOF property will be true if no record was
found.

HTH
Dale
 
A

abolen via AccessMonster.com

My code is

rst1.Seek rst(0), adSeekFirstEQ
pom = rst(mrbrkol)
rst1(mMaxBrKol) = pom
rst1.Update

and the line I want to add is
if rst.NoMatch then msgbox("text")
else ...
he does the rest of the things I need. How do I do that?
Ana
 
D

Dale_Fye via AccessMonster.com

rst1.Seek rst(0), adSeekFirstEQ
if rst1.EOF then
msgbox "Not found"
else
pom = rst(mrbrkol)
rst1(mMaxBrKol) = pom
rst1.Update
end if

HTH
Dale
 
A

Ana via AccessMonster.com

Thank you, Dale!
I wrote that, but that if is just a part of several others ifs, so I probably
mixed up some of the end ifs and got neverending loop. I'll try to do it
again and pay more attention, becouse now I know that's the right way. Thanks!

Ana
 
J

JimBurke via AccessMonster.com

You must be using an ADO recordset - ADO doesn't have a NoMatch property. You
need to use DAO in order to use NoMatch, but as someone else noted, you
should be able to use EOF with the ADO recordset instead.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top