hindersaliva
asked on
Excel VBA get Access table names with ADO
I got this to work.
I'd like to get the list into an InCell Dropdown (Data Validation list). For that I need to convert the list to a comma separated string. I can't figure out how. Any help please?
Sub GetTableNames()
'https://www.pcreview.co.uk/threads/get-table-names-from-access-through-vba-in-excel.986969/
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim lRow As Long
Dim szConnect As String
Sheet1.UsedRange.Clear
szConnect = "Provider = Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=C:\VolManAppMan\Database\appman.accdb;"
Set cnn = New ADODB.Connection
cnn.CursorLocation = adUseClient
cnn.Open szConnect
Set rs = cnn.OpenSchema( _
adSchemaTables, _
Array(Empty, Empty, Empty, "Table"))
With Sheet1
.Range(.Range("A1"), _
.Range("A1").Cells(rs.RecordCount)) _
.Value = Application.Transpose( _
rs.GetRows(, , "TABLE_NAME"))
End With
rs.Close
cnn.Close
End Sub
I'd like to get the list into an InCell Dropdown (Data Validation list). For that I need to convert the list to a comma separated string. I can't figure out how. Any help please?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER