Solved

recordcount not working......

Posted on 2002-05-24
3
142 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
3 Comments
 
LVL 142

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

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…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

825 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