SQL Statement

M

Maracay

Hi Guys,

I have this sql statement, it works but I want to display a message if the
record is not found and continue if record is found, my question is how can I
capture these events, I will really appreciate any help

Thanks

Set rs = db.OpenRecordset( _
"select JobName, DocketGenInfo " & _
"from tblMDocket " & _
"where DocketNumber = " & Me.ComboDocketRef)
 
D

Daryl S

Maracay -

Test for the end-of-file right after your OpenRecordset. If it is true,
then no records were returned.

IF rs.EOF Then 'no records returned
<message here>
Else
<continue processing>
E
 
J

Jeff Boyce

One way to do this would be to test the RecordCount for that recordset you
opened.

If the RecordCount is 0, no records were found...

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 

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