Listing column (field) names for ACCESS

Posted on 2003-03-19
Medium Priority
Last Modified: 2010-05-18
I found how to list all the table names from an Access db, but now I need to list all the fields\column names in the table.  
Need this for vb6; pleez help
Question by:LosBear

Accepted Solution

Cimperiali earned 400 total points
ID: 8168586
'kipped: declare connection and recordset
dim theQuery as string
theQuery="select * from yourtable"
set rs= cnn.execute(thequery)
'the following you can do even if recorset is eof
dim fld as adodb.field
for each fld in rs.fields
    'now i write in immediate window, but you can use this value as you like
    debug.print fld.name

set rs= nothing
set cnn= nothing

Author Comment

ID: 8168975
that was it!
thx cimperiali

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question