Could there be something else missing (or in the wrong order) as placing the "set rs." before the ".Open" still gives an error.
I've moved the lines about that often I don't know which error relates to what but there are 2 errors. The first relates to the data source not being found and highlights the following line:
The second error relates to Object variable not being set.
Here's my code as it stands. Can someone place it in the correct order. Thanks.
VB Code:
Private Sub Form_Load()
Dim con As ADODB.Connection
Dim rs As ADODB.Recordset 'object
Dim ConnString As String
Set Text1.DataSource = rs
Set Text2.DataSource = rs
Set Text3.DataSource = rs
Set List1.DataSource = rs
Set con = New ADODB.Connection
con.ConnectionString = ConnString
con.Open ConnString
With con
ConnString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=c:\db1.mdb;" & _
"Persist Security Info=False"
End With
rs.Open "select * from Table1", con
Text1.DataField = "Field1"
Text2.DataField = "Field2"
Text2.DataField = "Field3"
Do Until rs.EOF
List1.AddItem rs!Description
rs.MoveNext
Loop
End Sub