I don't know if this would help you. This is a routine I used for a quality control program. The csv file had 4 rows with the max 20 lines, hence arrData(80) but It can be less than 20 lines also. I used this to take dimensions off an autocad drawing (which never was more than 20) and fill in the text boxes.
Kim is correct, it must be the same form of csv format each time.
Private Sub Import_Click() On Error GoTo HandleError RoutineName = Form.Name & " Import_Click Event" Dim Detline As String 'Record form selected file Dim I As Integer 'Index for rows (table & array) Dim FF As Integer 'next file number available for use by the Open statement Dim dlgOpen As FileDialog Set dlgOpen = Application.FileDialog(msoFileDialogOpen) With dlgOpen With .Filters .Clear .Add "Import csv or txt", "*.csv; *.txt", 1 .Add "All Files", "*.*", 2 End With .InitialFileName = "c:\QControl\" .FilterIndex = 1 .AllowMultiSelect = False .Title = "Select document to import" .ButtonName = "Ok" .Show If .SelectedItems.Count > 0 Then SelectedFile = .SelectedItems(1) End If End With ReDim arrData(80) DoCmd.GoToRecord acDataForm, "Main QC Form", acNewRec I = 1 ' initalize counter FF = FreeFile 'Use FreeFile to supply a file number that is not already in use. Open SelectedFile For Input As #FF Do While Not EOF(FF) 'Read selected file line by line Line Input #FF, Detline arrData = Split(Detline, ",") Me.Controls("letter" & I) = arrData(0) Me.Controls("printdim" & I) = arrData(1) Me.Controls("stepnumber" & I) = arrData(2) Me.Controls("Gage" & I) = arrData(3) I = I + 1 'increment counter Loop RunCommand acCmdSaveRecord ' Save the Record you're looking at Me.Requery ' Force the Recordset of the Form to update Me.Form1.Requery Close #FF 'close text file DoCmd.GoToRecord , , acLast Exit_Import_Click: DoCmd.SetWarnings True Exit Sub HandleError: RtnCode = ErrorHandler (EH_NumError:=Err.Number,DescError:= Err.Description,NameRoutine:=RoutineName) Resume Exit_Import_Click End Sub