Karen,
Here's some sample code to do what you want (I understand you want to
append records, right?):
Sub split_csv()
Dim db As DAO.Database
Dim rst As DAO.Recordset
InputFile = "C:\SomeFolder\SomeFile.csv"
TargetTable = "MyTable"
Delim = ","
Open InputFile For Input As #1
Set db = CurrentDb
Set rst = db.OpenRecordset(TargetTable)
Do Until EOF(1)
Line Input #1, InpString
FVals = Split(InpString, Delim)
rst.AddNew
For i = 0 To rst.Fields.Count - 1
rst.Fields(i) = FVals(i)
Next
rst.Update
Loop
rst.Close
Set rst = Nothing
Set db = Nothing
Close #1
End Sub
Note: The code assumes the fields in the .csv file are the same number
and in the same order as the field tables. If not, the code will need
some modifications.
To run this code, it is required to have an appropriate DAO Object
Library reference. While in the VB editor window, go to menu item Tools
References; check if a Microsoft DAO reference is present among the
ones checked at the top of the list. If not, scroll down to find the
appropriate Microsoft DAO X.X Object Library reference and check it. The
appropriate reference is DAO 3.51 for A97, DAO 3.6 for A2K or later.
HTH,
Nikos