Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 13th, 2008, 12:49 AM
Registered User
Join Date: Feb 2007
Location: Alhambra, CA, USA.
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
Reply With Quote
  #2 (permalink)  
Old March 13th, 2008, 03:05 PM
Friend of Wrox
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
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.
Reply With Quote
  #3 (permalink)  
Old March 13th, 2008, 03:27 PM
Friend of Wrox
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
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
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 h@ckerz 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

All times are GMT -4. The time now is 09:17 PM.

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