I'm trying to list the tables from a sql server database in an access form
I have a continuos form wih one field Named TABLE_NAME and it's recordsource set to TABLE_NAME
with the following code
Private Sub Form_Open(Cancel As Integer)
Dim objConnection As ADODB.Connection
Dim rst As New ADODB.Recordset
Dim strSQL As String
Dim strConnectionString As String
Dim strTableName As String
strConnectionString = SouthConnectionString
Set objConnection = CreateObject("ADODB.Connection")
objConnection.ConnectionString = strConnectionString
objConnection.Open
Set rst = objConnection.OpenSchema(adSchemaTables)
' loop through the field names list:
While Not rst.EOF
Debug.Print rst!TABLE_NAME
rst.MoveNext
Wend
Set Me.Recordset = rst
Me.Requery
rst.Close
objConnection.Close
Set rst = Nothing
Set objConnection = Nothing
End Sub
this gives me the table names in the immediate window but no records are displayed on the form
I have a continuos form wih one field Named TABLE_NAME and it's recordsource set to TABLE_NAME
with the following code
Private Sub Form_Open(Cancel As Integer)
Dim objConnection As ADODB.Connection
Dim rst As New ADODB.Recordset
Dim strSQL As String
Dim strConnectionString As String
Dim strTableName As String
strConnectionString = SouthConnectionString
Set objConnection = CreateObject("ADODB.Connection")
objConnection.ConnectionString = strConnectionString
objConnection.Open
Set rst = objConnection.OpenSchema(adSchemaTables)
' loop through the field names list:
While Not rst.EOF
Debug.Print rst!TABLE_NAME
rst.MoveNext
Wend
Set Me.Recordset = rst
Me.Requery
rst.Close
objConnection.Close
Set rst = Nothing
Set objConnection = Nothing
End Sub
this gives me the table names in the immediate window but no records are displayed on the form