Need help with slowness.
what i need to do is compare a spreadsheet (audit) to information in a database. what i am doing is uploading information in each row to a database where primary information blnumber on spreadsheet = primary key, then uploads information matching column header to field name.
What it's doing is going line by line, looping from column A to last column while inserting info to access database. the more lines there are on the spreadsheet, the slower it runs. heres the column looping code. can it be better?
c = current column number
a = current row number
colheader(c) is spreadsheet header that matches up with database field name.
For c = 1 To lastCol Step 1
On Error GoTo ErrorNoField
entryvalue = Cells(a, c).Value2
If entryvalue <> "" Then
sSQL = "UPDATE tblA SET " & colheader(c) & "= '" & entryvalue & "' WHERE BL = '" & blnumber & "';"
militarydb.Execute (sSQL)
End If
Next c
what i need to do is compare a spreadsheet (audit) to information in a database. what i am doing is uploading information in each row to a database where primary information blnumber on spreadsheet = primary key, then uploads information matching column header to field name.
What it's doing is going line by line, looping from column A to last column while inserting info to access database. the more lines there are on the spreadsheet, the slower it runs. heres the column looping code. can it be better?
c = current column number
a = current row number
colheader(c) is spreadsheet header that matches up with database field name.
For c = 1 To lastCol Step 1
On Error GoTo ErrorNoField
entryvalue = Cells(a, c).Value2
If entryvalue <> "" Then
sSQL = "UPDATE tblA SET " & colheader(c) & "= '" & entryvalue & "' WHERE BL = '" & blnumber & "';"
militarydb.Execute (sSQL)
End If
Next c