
Does anybody can help me with my problem?
Here is a VBA macro that does what you want using DAO. You must have a
reference to 'MS DAO 3.0 Object Library' in theTools-References menu.
Brian Walton
Sub db1()
Dim oMyDB As Database
Dim oMyDBrs As Recordset
Dim iMyFreeFile As Integer
Dim sField0 As String
Dim sField1 As String
' open the database you want to write to
Set oMyDB = Workspaces(0).OpenDatabase("c:\mydocu~1\xltest.mdb")
' set the recordset to the table you want to write to
Set oMyDBrs = oMyDB.OpenRecordset("table1", dbOpenDynaset)
' get a freefile number
iMyFreeFile = FreeFile
' open the csv file
Open "c:\mydocu~1\xltest.csv" For Input As #iMyFreeFile
' loop through the csv file & write to the database
Do While Not EOF(iMyFreeFile)
' get the next two fields in the csv file
Input #iMyFreeFile, sField0, sField1
' create a new record
oMyDBrs.AddNew
' must update the record after creating new
oMyDBrs.Update
' make sure you are on new record you just created
oMyDBrs.MoveLast
' go into edit mode
oMyDBrs.Edit
' update the record.
oMyDBrs.Fields(0).Value = sField0
oMyDBrs.Fields(1).Value = sField1
oMyDBrs.Update
Loop
' now close the file
Close #iMyFreeFile
End Sub