Some of my Excel files have only 2 records , some files have 160 records how can I change the FOR loop accordingly?
or is there a better way to check and loop and update the table?
Set xlc = xls.Range("A3")
Set rst = CurrentDb.OpenRecordset("B_temp") ', dbOpenDynaset, dbAppendOnly)
For i = 0 To 200
rst.AddNew
For lngColumn = 0 To rst.Fields.Count - 1
rst.Fields(lngColumn).Value = xlc.Offset(i, lngColumn).Value
' MsgBox xlc.Offset(i, lngColumn).Value
Next lngColumn
rst.Fields("File_name") = strFileName
rst.Update
Next i
End If
Thank you
Bookmarks