We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

vb5-rdo

SWP
SWP asked
on
Medium Priority
182 Views
Last Modified: 2010-04-30
Dear Experts,

Can you please  tell me how to detect there is no records in database by using RDO method ?
thanks


SWP
Comment
Watch Question

Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Commented:
If you want to check a resultset it is easier if you use if RS.rowcount = 0.
usermiles example with give a error if there is no record in the table.

Commented:
I agree with veroland. The best way is to check the count property

Commented:
Depending on the datasource and the ODBC driver in use, rowcount can be expensive.  I suggest the following:

if rst.eof and rst.bof then
    Exit Sub
Else
    'Process the records
endif

No need here to use a move method (which is what could generate the error)

SWP

Author

Commented:
UserMiles:

   thanks for ur answer, but I prefered using the following:) since the I am using the SQL Server, there are no problems in using the rowCount method, but if I am using the Acces Driver, then
jharri's method is suggested.

 If rs.rowcount=0 then
    msgbox "no record found"
end if
 
but I heard jharri said that the rowcount is expensive, why do u think so ?



SWP
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.