Query to get the Columns and datatype of the Tables

A

Ahmed Ali

Hi,

Can some one tell me the query to get the Columns and the datatypes of the
Access Tables. In SQL server we have syscolumns table which contains all the
information about the columns.

Thanx in advance.

Regards

Ahmed
 
N

Nauman

Hi
This code works !!

Dim i As Integer, iFieldsCount As Integer


'***************************************************************************
**
' To get the user defined tables

'***************************************************************************
**
Set rst = conn.Execute("SELECT name from msysobjects where
(msysobjects.type)=1 And flags = 0")
If Not rst.EOF Then rst.MoveFirst



'***************************************************************************
**
' To get the names of columns and data types for each table

'***************************************************************************
**
While Not rst.EOF
Set rstcol = conn.Execute("select * from " &
rst.Fields("name").Value & " ")

iFieldsCount = rstcol.Fields.count

For i = 1 To iFieldsCount - 1
List1.AddItem (rstcol.Fields(i).Name)
List2.AddItem (rstcol.Fields(i).Type) ' this wud give u
some integer value and u can map it
Next i
rst.MoveNext
Wend

Best Regards
Nauman
 

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