I have a vbscript that I had been running daily and it has been fine. After not having run it for a few weeks, when I tried yesterday it appeared to just hang. After troubleshooting I found that actually it wasn't hung, but one line of code (a single UPDATE to an Access 365 database) was taking an exceedingly long time. I isolated that code below, executing that sql statement takes approx 40 seconds (which is a problem since it iterates through a loop 2000 times):
However, when I change the AND statement to below, the UPDATE executes immediately!
The script runs in a Citrix environment that I don't have full control over, but I can't think what could have changed to make this code start moving at a snails pace, and why not appending two fields in my AND statement would make the problem go away. If I have to change my code to extract the Client ID and Sub ID bits and use the second sql everywhere, so be it, but I don't get what would cause this.
I appreciate any ideas!!
Code:
Option Explicit
Const sRoot = "U:\TaxReports\VB\"
Dim ConnMDB
Set ConnMDB = CreateObject("ADODB.Connection")
ConnMDB.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & sRoot & "\AccessReports.mdb;"
Dim rs, sql
Set rs = CreateObject("ADODB.Recordset")
sql = "UPDATE AllProjects SET EfileFederal = '" & data & "' WHERE [Project Name] = '2020 Return' [highlight #FCE94F]AND [Client ID] & '.' & [Sub ID] = '000002.00'[/highlight]"
ConnMDB.Execute sql
However, when I change the AND statement to below, the UPDATE executes immediately!
Code:
sql = "UPDATE AllProjects SET EfileFederal = '" & data & "' WHERE [Project Name] = '2020 Return' [highlight #FCE94F]AND [Client ID] = '000002' AND [Sub ID] = '00'[/highlight]"
The script runs in a Citrix environment that I don't have full control over, but I can't think what could have changed to make this code start moving at a snails pace, and why not appending two fields in my AND statement would make the problem go away. If I have to change my code to extract the Client ID and Sub ID bits and use the second sql everywhere, so be it, but I don't get what would cause this.
I appreciate any ideas!!