Obtaining Table Field Names via SQL

  • Thread starter Thread starter Peter L
  • Start date Start date
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
 
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.
 
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
 
Back
Top