Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 9th, 2005, 05:49 AM
Authorized User
 
Join Date: Jan 2005
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to get # of recs without opening recordset

How to get number of recs without opening recordset?

I have successfully established the connection to a database as follows

Dim conn As New ADODB.Connection
conn.Open "driver={Microsoft ODBC for Oracle};" & _
    "server=js;" & _
    "uid=hsonsche;pwd=hsons"
Set Cat = New ADOX.Catalog
Cat.ActiveConnection = conn

I have also succeeded in listing the tables contained in the database
in a combobox as follows:

Tbl = 1
Do While Tbl < Cat.Tables.Count
    If Trim$(UCase(Cat.Tables(Tbl).Type)) = "TABLE" Or Trim$(UCase(Cat.Tables(Tbl).Type)) = "VIEW" Then
        If Mid(Cat.Tables(Tbl).Name, 3, 1) <> "$" Then
            Downloader.Combo4Tables.AddItem Cat.Tables(Tbl).Name
        End If
    End If
    Tbl = Tbl + 1
Loop

Now the problem is that I need the combo4Tables should include Name_of_Table & Tables(Tbl).NumberofRecords

what is the syntax?

I would not like to use a recordset to first load the recs in it and then count them, is there a short cut way of doing this?







Similar Threads
Thread Thread Starter Forum Replies Last Post
Recordset empty when opening querydef DeAnzaJig Access VBA 3 November 14th, 2005 09:31 AM
Want to get number of recs without opening rs amjad_mahmood Pro VB Databases 2 August 10th, 2005 12:44 AM
Opening A RecordSet Onyx2ir Access VBA 6 December 31st, 2003 12:46 AM
Problem using WHERE clause in opening Recordset johnman Classic ASP Databases 2 October 23rd, 2003 01:30 PM
Trouble Opening Recordset NicholasM Classic ASP Databases 1 October 18th, 2003 04:03 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.