vbgirl 0 Newbie Poster

can everybody help me...

Public cnName As Connection
Public rsId As Recordset



Private Sub cmdImport_Click()
Dim a(50) As String
Dim c(50) As String
Dim ProductID(50) As String
Dim i As Integer
i = 0

          cdbOpenFile.Filter = "Text Files (*.txt)|*.txt| "
          
          'Specify default file name to open
          cdbOpenFile.FileName = ""
          ' Specify default filter to *.txt
          cdbOpenFile.FilterIndex = 1
          
          ' Display the Open dialog box, and
          ' save the selected file in the
          ' variable FileSelect
            cdbOpenFile.ShowOpen



Open cdbOpenFile.FileName For Input As #1
Do Until EOF(1)
Dim id
Line Input #1, a(i)
id = Split(a(i), ".")
ProductID(i) = id(0)
a(i) = id(1)
'c(i) = id(2)
'MsgBox c(i), vbOKOnly, "Text File"
i = i + 1
Loop
Close #1

Dim b As Integer
b = i

Path = App.Path
Set cnName = New ADODB.Connection
With cnName
    .CursorLocation = adUseClient
    .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Path & "\name.mdb;Persist Security Info=False;Jet OLEDB"
    .Open
End With

Set rsId = New ADODB.Recordset
rsId.Open "ID", cnName, adOpenKeyset, adLockOptimistic

'With rsId
'.MoveFirst
'While Not .EOF
'MsgBox .Fields(0), vbOKOnly, "Access file"
'.MoveNext
'Wend
'End With
With rsId
.MoveFirst
Dim d As Integer
d = 0

For i = 0 To b - 1
Do While Not .EOF
If ProductID(d) = rsId.Fields(0) Then
rsId.Fields(5) = a(i)
rsId.Update
End If
rsId.MoveNext
Loop
rsId.MoveFirst
'd = d + 1
Next
MsgBox "Done", vbOKOnly + vbInformation, "Complete"
End With

'when data done all will show a message box "DONE"
'MsgBox "Done", vbOKOnly + vbInformation, "Complete"
End Sub

urgent.. please