I've got the following code, and its taking a while to run, so I was checking to see if there is anything I can change in the .execute's to help the speed.
Or optimize the update queries in anyway, or maybe the tables?
The connection is an access 97 database, and on 21000 rows this takes 94secs to run.
Or optimize the update queries in anyway, or maybe the tables?
The connection is an access 97 database, and on 21000 rows this takes 94secs to run.
Code:
'outstanding balance
If rs!OutBalance Then
sSQL = "UPDATE " & rs!Tablename & " SET [OutBalance]=[Amount] WHERE [FlowDate]>=#" & sSight
gcxCool.Execute sSQL, lAff, adCmdText
LogFile "Prog", rs!Tablename & " has " & lAff & " amounts outstanding"
End If
'sight balance
sSQL = "UPDATE " & rs!Tablename & " SET [Balance]=[Amount] WHERE [FlowDate]=#" & sSight
gcxCool.Execute sSQL, lAff, adCmdText
LogFile "Prog", rs!Tablename & " has " & lAff & " amounts at 0 days"
'7 day
sSQL = "UPDATE " & rs!Tablename & " SET [Balance7]=[Amount] WHERE [FlowDate] BETWEEN #" & sSight & " AND #" & s7Days
gcxCool.Execute sSQL, lAff
LogFile "Prog", rs!Tablename & " has " & lAff & " amounts at 7 days"
'30 day
sSQL = "UPDATE " & rs!Tablename & " SET [Balance30]=[Amount] WHERE [FlowDate] BETWEEN #" & sSight & " AND #" & s30Days
gcxCool.Execute sSQL, lAff
LogFile "Prog", rs!Tablename & " has " & lAff & " amounts at 30 days"
'guesstimate the 90 day value?
If rs![90DayCalc] Then
sSQL = "UPDATE " & rs!Tablename & " SET [Balance90]=[Balance30]*3"
gcxCool.Execute sSQL, lAff
LogFile "Prog", rs!Tablename & " 90 day amount is 30 day amount x 3"
Else
sSQL = "UPDATE " & rs!Tablename & " SET [Balance90]=[Amount] WHERE [FlowDate] BETWEEN #" & sight & " AND #" & s90Days
gcxCool.Execute sSQL, lAff
LogFile "Prog", rs!Tablename & " has " & lAff & " amounts at 90 days"
End If