Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bind ado recordset to access form

Status
Not open for further replies.

clapper62

Programmer
Apr 17, 2003
113
0
0
US
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
 
oops figured it out
I took the Me.Requery out and it works fine now
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top