Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: RE: How to retrive field names from a table


Message #1 by Rick Crofoot <rcrofoot@e...> on Mon, 15 Apr 2002 22:40:11 +0100
Hi Everybody,
I try to retrive the field values of a selected table through ADO using 
the following code.I am getting run time error:3265 and the filds list is 
not displaying.Please let me know how to get the field names from the 
table.
*************
Dim cnn As New ADODB.Connection
   Dim cat As New ADOX.Catalog
   Dim tbl As ADOX.Table
   Dim i As Integer
   cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
     "Data Source=C:\linker.mdb;"
   
   Dim rs As ADODB.Recordset
   Set rs = cnn.OpenSchema(adSchemaColumns)
   
    'Loop through the results and print
    'the names in the debug window
    Do Until rs.EOF
    If rs.Fields("TABLE_COLUMNS") <> "VIEW" Then
        Debug.Print rs.Fields("TABLE_COLUMNS")
    End If
    rs.MoveNext
*************
Thanks.
    Loop

  Return to Index