rows are updating but last row of the excel sheet is not updating(changing)
Code:
Dim dbconn As New ADODB.ConnectionDim stDB, strConn
Dim totColumns, totRows, i, j, WDS_id
Dim prBatchName, prTableQry, inTableQry, prTableQry1, dbQry
Dim rs As New ADODB.Recordset
'Path to the database.
stDB = "mysql32"
'Create the connectionstring.
strConn = "Driver=MySQL ODBC 5.2 Unicode Driver;" _
& "Data Source=" & stDB & ";"
Sheet1.Activate
prBatchName = "tblProd_AGR_006"
totColumns = ActiveSheet.Cells(2, 1).CurrentRegion.Columns.count
totRows = ActiveSheet.Cells(3, 1).CurrentRegion.Rows.count
'prBatchName = ActiveSheet.Cells(3, totColumns + 1).Values
dbconn.Open strConn
rs.CursorLocation = adUseServer
rs.Open "select * from " & prBatchName, dbconn, adOpenStatic, adLockOptimistic
For j = 3 To totRows
WDS_id = ActiveSheet.Cells(j, 1)
rs.Find "WDS_ID=" & WDS_id
For i = 2 To totColumns
rs(ActiveSheet.Cells(2, i).Value) = ActiveSheet.Cells(j, i)
Next
rs.Update
Next
rs.Close
dbconn.Close
MsgBox "Data updated sucessfully"