Solved

vb5-rdo

Posted on 1998-09-08
5
157 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
0
Comment
Question by:SWP
5 Comments
 

Accepted Solution

by:
usermiles earned 50 total points
ID: 1433729
rstObject.movefirst
   If rstObject.EOF = True Then    
      MsgBox "No Records were found"
   End If

If you use the rst.EOF command in the above example, this will set the resultset to the first record , and the If statement tests to see if you are at the end of the file.
0
 
LVL 2

Expert Comment

by:Veroland
ID: 1433730
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.
0
 

Expert Comment

by:manish77
ID: 1433731
I agree with veroland. The best way is to check the count property
0
 

Expert Comment

by:jharri
ID: 1433732
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)

0
 

Author Comment

by:SWP
ID: 1433733
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
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now