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 March 13th, 2008, 12:49 AM
Registered User
Join Date: Feb 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default VB Net Ms Access list column names (how to sample)

VB Net 2005 how to list all MSAccess Table Column Names in the database MS.MDB
Old March 13th, 2008, 03:05 PM
Friend of Wrox
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts

Databases don't have column names, tables do. There is a tables collection that you can iterate through to find the tables in the DB. (You should probably skip the ones that start with "MSys".)

You can find the column names in a tabledef of each of the table you find in the tables collection.
Old March 13th, 2008, 03:27 PM
Friend of Wrox
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts

Public Sub FieldLister()

    Dim tdf As Variant
    Dim fld As Variant

    For Each tdf In CurrentDb.TableDefs

        If Left(tdf.Name, 4) <> "MSys" Then
            Debug.Print tdf.Name

            For Each fld In tdf.Fields
                Debug.Print fld.Name
            Next fld

        End If


    Next tdf

End Sub

Similar Threads
Thread Thread Starter Forum Replies Last Post
MS Access With VB.NET N4T3.T4NN3R ADO.NET 0 October 9th, 2008 01:47 PM
Vb.net 2005 using MS Access johnnys14 SQL Language 0 July 10th, 2008 01:14 PM
VB.NET 2005 to MS Access [email protected] VB Databases Basics 5 March 6th, 2007 11:22 AM
Connecting database using ms access and vb.net adil_farooq Access 0 October 27th, 2005 11:54 PM
VB.NET in Foreground and MS Access in Background szms VB.NET 2002/2003 Basics 0 April 13th, 2005 11:59 AM

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