Hello,
I create this code which copy some fileds from mdb to an xls and it works fine. But now I have some problems with the opposite operation. Does everyone know a similar function like OpenRecordset but to write into an database?
Sub example()
Dim d As Database
Dim r As Recordset
Dim SQL$
SQL$ = "SELECT name,number FROM salvador"
Set d = OpenDatabase("c :\datos\example .mdb")
Set r = d.OpenRecordset (SQL$, dbOpenDynaset)
For i = 0 To r.Fields.Count - 1
Cells(1, i + 1) = r.Fields(i).Nam e
Next
Range("a2").Cop yFromRecordset r
r.Close
d.Close
End Sub
Please help..........t hank you very much, Buru
I create this code which copy some fileds from mdb to an xls and it works fine. But now I have some problems with the opposite operation. Does everyone know a similar function like OpenRecordset but to write into an database?
Sub example()
Dim d As Database
Dim r As Recordset
Dim SQL$
SQL$ = "SELECT name,number FROM salvador"
Set d = OpenDatabase("c :\datos\example .mdb")
Set r = d.OpenRecordset (SQL$, dbOpenDynaset)
For i = 0 To r.Fields.Count - 1
Cells(1, i + 1) = r.Fields(i).Nam e
Next
Range("a2").Cop yFromRecordset r
r.Close
d.Close
End Sub
Please help..........t hank you very much, Buru
Comment