CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 1999
    Posts
    2

    How do I know the number of columns in Access database using Visual Basic programming

    Can anyone please tell how to count the number of COLUMNS in Access database by using Visual Basic programming? Thank you.


  2. #2
    Join Date
    Jul 1999
    Posts
    20

    Re: How do I know the number of columns in Access database using Visual Basic programming

    Try this
    Change the names of mdb and table names.

    Dim db As Database
    Dim rs As Recordset
    Set db = opendatabase("C:\Program Files\MSOFFICE\access\Samples\northwind.mdb")
    Set rs = db.OpenRecordset("select * from customers", dbOpenSnapshot)
    MsgBox CStr(rs.Fields.Count)
    rs.Close
    db.Close



  3. #3
    Join Date
    May 1999
    Posts
    3,332

    Re: How do I know the number of columns in Access database using Visual Basic programming

    you can inspect the TableDefs collection of the database object in DAO and query the fields.count property.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured