Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics 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:31 AM
Authorized User
Join Date: Jan 2005
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Default Pls Help me count records [soon after connection]

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;" & _
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

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?

Old August 30th, 2005, 07:20 PM
Authorized User
Join Date: Aug 2005
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts

usually you will have to open the recordset and movelast() before asking for the .count() - in DAO, if you queried the recordset before moving to the last record, it would return a false value - fun...

Similar Threads
Thread Thread Starter Forum Replies Last Post
help pls with connection string arian29 VB Databases Basics 10 August 29th, 2008 11:17 PM
sql count function - urgent and pls help miki SQL Language 1 June 14th, 2006 09:47 AM
Count of form records siptah Access VBA 3 April 20th, 2005 09:09 AM
Count, sum, count a value, return records CongoGrey Access 1 April 18th, 2005 02:25 PM
sql count function - pls help and urgent miki MySQL 1 May 12th, 2004 05:55 AM

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