Dim FileLine As String
Dim Field1 As String
Dim Field2 As String
Dim Field3 As String
Dim Field4 As String
Dim Field5 As String
Dim Field6 As String
Dim NextFieldStart As Long
Dim NextFieldEnd As Long
Dim sql As String
Dim rs As ADODB.Recordset
sql = "select NameOfField1, NameOfField2, NameOfField3, "
sql = sql & "NameOfField4, NameOfField5, NameOfField6, "
sql = sql & "from NameOfTableWithTheseFields where "
sql = sql & "NameOfIdentityColumn = -1"
Set rs = New ADODB.Recordset
rs.Open sql, Your_Connection_Variable, adOpenKeySet, adLockPessimistic adCmdText
Open "C:\csvfilename.csv" for input as #1
Your_Connection_Variable.BeginTrans 'Start a transaction
'this allows you to update the recordset when reading the
'fields, then call the RollBack method if you dont want
'these records in your table
While Not EOF(1)
Input #1, FileLine
NextFieldEnd = InStr(FileLine, ",") - 1
Field1 = Mid(FileLine, 1, NextFieldEnd)
NextFieldStart = NextFieldEnd + 2 'or maybe + 1
NextFieldEnd = InStr(NextFieldStart, FileLine, ",") - 1
Field2 = Mid(FileLine, NextFieldStart, NextFieldEnd - NextFieldStart)
NextFieldStart = NextFieldEnd + 2
NextFieldEnd = InStr(NextFieldStart, FileLine, ",") - 1
Field3 = Mid(FileLine, NextFieldStart, NextFieldEnd - NextFieldStart)
'Get the other 3 fields in the same way
If <put your criteria here> Then
'Fill your textboxes here, it wont add these fields
'to the recordset
Else
rs.AddNew
rs("Field1Name") = Field1
rs("Field2Name") = Field2
rs("Field3Name") = Field3
'do the same thing for the next 4 fields
rs.Update
End If
Wend
'If you want to add the records you added to the recordset
'to the table use this line
Your_Connection_Variable.CommitTrans
'if you don't want to, use this line
Your_Connection_Variable.RollBackTrans