Obtaining Table Field Names via SQL

P

Peter L

Hi,

I want to know if it is possible to obtain field
definition information from an SQL query.

Most applications have a catalogue that can be queried
where you can select the table name and the names of the
fields within the table.

I've checked through the MSAccess "hidden" tables and the
only one that comes close to providing this information is
the MsSysObjects table, but it does not give up column
(field) heading information.

I'm using Access 97.

Many thanks in advance
 
S

Sean

It may be better to write some code using DAO to get what you want from your
database.

I won't put any code here as the Access help file contains untold examples
on how to loop through DAO objects and properties.

check out the help, suss the object model, it's pretty easy, especially if
you just copy some example code.
 
L

Luiz Cláudio

Hi Peter,

you'd better use a schema recordset.

Dim cnn As ADODB.Connection

Set cnn = CurrentProject.Connection
Set rst = cnn.OpenSchema(adSchemaColumns)

In this recordset you'll have Table_Name, Column_Name and Description
fields.

[]
Luiz Cláudio C. V. Rocha
São Paulo - Brazil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top