Query to get the Columns and datatype of the Tables

  • Thread starter Thread starter Ahmed Ali
  • Start date Start date
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
 
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
 
Back
Top