Solved

recordcount not working......

Posted on 2002-05-24
3
143 Views
Last Modified: 2010-05-02
i am using a stored procedure to "fill" a recordset but the recordset.recordcount = 0 doesnt seems to work at all!
anyone can point me into the right direction?

sqlstr = "up_Top_ABCD '" & period8 & "' "

Set rsInvDetailStatus = New ADODB.Recordset

With rsInvDetailStatus
  .CursorLocation = adUseServer
  .Open sql66, frmMainMenu.db, adOpenKeyset, adLockBatchOptimistic, adCmdText
End With

If rsInvDetailStatus.RecordCount = 0 Then
  errmsg = MsgBox("No matching records found!", vbCritical, "No records found")
  Set rsInvDetailStatus.ActiveConnection = Nothing

else

 msgbox "have records"

end if
0
Comment
Question by:spiral
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 50 total points
ID: 7031593
instead of
If rsInvDetailStatus.RecordCount = 0 Then
use
If rsInvDetailStatus.BOF and rsInvDetailStatus.EOF Then

Explanation:
the value of Recordcount is most surely -1, as the cursorlocation is on the server (if you can change to client, this can solve, but not in all the cases). The only expression that can be used for sure is the .eof and .bof

CHeers
0
 
LVL 1

Expert Comment

by:zzconsumer
ID: 7031687
Before opening the Recordset, use:

rsInvDetailStatus.CursorLocation = adUseClient

This will enable you to use .RecordCount
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7032196
I am sure if you were to maintain your open questions, you would find experts more receptive.  For the record:

Questions Asked 19
Last 10 Grades Given A A B A A B A B B B  
Question Grading Record 11 Answers Graded / 11 Answers Received

Anthony
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

730 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