Hello,
I'm kind of newby in VBA/SQL in access.
I'm trying to write a code that sums several columns and the result should be "updated" to a Total record.
I get no error message, but it doesn't work.
What can be wrong?
Here's part of the code.
Any help should be appreciated.
I'm kind of newby in VBA/SQL in access.
I'm trying to write a code that sums several columns and the result should be "updated" to a Total record.
I get no error message, but it doesn't work.
What can be wrong?
Here's part of the code.
Code:
sqlselect = "SELECT * From 12MonthsTemp" Set objrs = conn.Execute(sqlselect) If (objrs.EOF <> True) Then nrows = objrs.GetRows For i = 0 To UBound(nrows, 2) bdate = nrows(0, i) edate = nrows(1, i) amnt = nrows(3, i) For j = 8 To 147 SumRws = SumRws + nrows(j, i) Next j tableupdate = "UPDATE 12MonthsTemp SET [Total Recognition]= " & SumRws & " WHERE ([Begin Date]='" & bdate & "') AND ([End Date]='" & edate & "') AND ([Invoice Amount]=" & amnt & ");" conn.Execute (tableupdate), NumOfRec, dbFailOnError Debug.Print NumOfRec & " records were updated." SumRws = 0 Next End If
Comment