This is the method that I use...
Dim cxn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim strSQL As String
Set cxn = New ADODB.Connection
Set rst = New ADODB.Recordset
With cxn
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
"Absolute Path to your DB"
.Open
End With
strSQL = _
"SELECT Title " & _
"FROM Book " & _
"WHERE book_id=1;"
rst.Open strSQL, cxn, adOpenStatic, adLockOptimistic
MyForm.MtTextBox.Text = rst!Title
rst.Close
Set rst = Nothing
cxn.Close
Set cxn = Nothing
I used 'MyForm.MtTextBox.Text = rst!Title' because I have this code in a seperate module named RecordSets and call it from the Form_Load sub that use it. It is up to you where you put I just prefer my code modules to look cleaner. Be sure to included references to Microsoft ActiveX Data Objects 2.5 Library (or Later) and Microsoft Data Binding Collection
VB 6.0 SP4 (or later.
Hope this helps......
Kenny Alligood