Hi all:
I'd like to add the schema columns to a listview control.
Using VBA Excel 2003.
Here's what I have:
I'm finding the field names easy enough, but I'd also like to find the Type (INT,Text...), the length, and other properties.
I'll post another question for checkboxes....
thanks,
Ron Repp
If gray hair is a sign of wisdom, then I'm a genius.
My newest novel: Wooden Warriors
I'd like to add the schema columns to a listview control.
Using VBA Excel 2003.
Here's what I have:
Code:
Private Sub TV1_Click()
Select Case TV1.SelectedItem.Key
Case "TABLE"
LV1.ListItems.Clear
LV1.ColumnHeaders.Clear
Exit Sub
Case "Root"
LV1.ListItems.Clear
LV1.ColumnHeaders.Clear
Exit Sub
Case "VIEW"
LV1.ListItems.Clear
LV1.ColumnHeaders.Clear
Exit Sub
Case Else
LV1.ColumnHeaders.Clear
LV1.ColumnHeaders.Add , , "Field"
Dim Con As ADODB.Connection
Dim FieldsRS As ADODB.Recordset
Dim S As String
Dim Pos As Integer
Dim LI As ListItem
LV1.View = lvwReport
Set Con = New ADODB.Connection
Con.ConnectionString = sCon
Con.Open sCon
Set FieldsRS = Con.OpenSchema(adSchemaColumns)
LV1.ListItems.Clear
While Not FieldsRS.EOF
If FieldsRS.Fields(2) = TV1.SelectedItem.Text Then
LV1.ListItems.Add , , FieldsRS(3)
Debug.Print "First"
Debug.Print FieldsRS(7)
Debug.Print "2nd"
Debug.Print FieldsRS(6)
End If
FieldsRS.MoveNext
Wend
Set FieldsRS = Nothing
End Select
Con.Close
Set Con = Nothing
End Sub
I'm finding the field names easy enough, but I'd also like to find the Type (INT,Text...), the length, and other properties.
I'll post another question for checkboxes....
thanks,
Ron Repp
If gray hair is a sign of wisdom, then I'm a genius.
My newest novel: Wooden Warriors