Recordcount of a Server side query

Posted on 2006-03-27
Last Modified: 2010-05-01
Hello All,

I am using ADO and VB 6. I am running a query to return all the records in a table:

Select * from Products

I have set the .CursorLocation = adServer so that the results do not consume the local machines memory.

I really need to know how many records are in the table.  The .recordCount property returns -1 (since it is a server side query). I was thinking there must be a sql query I could run to determine how many records are in the table.

Like for example "SELECT COUNT(??) of Products" or something similiar where "??" is a field name or something.  Any ideas?

I guess bottom line is there a SQL query that will return the number of records in the table?
Question by:johnlewe
    LVL 35

    Accepted Solution

    SELECT COUNT(*) FROM [Products]

    in your
    LVL 35

    Expert Comment

    by:[ fanpages ]
    in your table, select one column, say, [Name]:

    SELECT COUNT([Name]) From [Products]

    Also, in ADO code:


    Then query objRecordset.RecordCount


    LVL 35

    Expert Comment

    by:[ fanpages ]
    Thanks for closing the question.


    [ ]

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Introduction In a recent article ( for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
    I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
    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…

    754 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

    19 Experts available now in Live!

    Get 1:1 Help Now