Hi,
wind2k and xp
access 2k
I have this problem I can not seem to be able to resolve. It is urgent that I fix it for my project.
The code bellow is a test: It is to pick up the data from Titles tables in db1.mdb in the c:\ and put in the excel sheet. However it does not work and I am stuck. Please somebody help me.
Note:
When highliting the db it is set at 'nothing' I don't understand.
Code:
Private Sub CommandButton1_Click()
On Error Resume Next
Dim db As Database
Dim rs As Recordset
Dim fld As Field
Dim i As Integer
Set db = OpenDatabase("c:\db1.mdb")
Set rs = db.OpenRecordset("Titles", dbOpenDynaset, dbReadOnly)
[A2].CopyFromRecordset rs
For Each fld In rs.Fields
i = i + 1
Cells(1, i).Value = fld.Name
Next fld
ActiveSheet.Columns.AutoFit
db.Close
End Sub
I have MS DAO 3.51 Object Library
MS Access 9.0 Object Library.
What other Libraries do I need to make this work?