I have VBA code in access 2007 that's been running unexpectedly over 24hrs. Whenever I issue 'ctrl+break' to check progress and step through code with F8 all appears well although msaccess reports it is 'not responding'.
When I first saw the 'not responding' I stopped the app, checked the code and results, the results table contains the data I am seeking. At the pace the code is running, the app may be running another 12hrs!
The only thing I can think of now is to insert a timer of some sort to determine where I am wasting resources. Is there code I can place with the loopcounter to determine the length of time the loop took to process a record?
Code snippet:
When I first saw the 'not responding' I stopped the app, checked the code and results, the results table contains the data I am seeking. At the pace the code is running, the app may be running another 12hrs!
The only thing I can think of now is to insert a timer of some sort to determine where I am wasting resources. Is there code I can place with the loopcounter to determine the length of time the loop took to process a record?
Code snippet:
Code:
MySQL = "SELECT bpa_productTemp.site, bpa_productTemp.productName, bpa_productTemp.yr, bpa_productTemp.mo, bpa_productTemp.productPercentage FROM bpa_productTemp ORDER BY bpa_productTemp.site, bpa_productTemp.productName, bpa_productTemp.productMonthReported;"
Set db = CurrentDb
Set rstA = db.OpenRecordset(MySQL)
Set rstB = db.OpenRecordset("bpa_product_monthly", dbOpenDynaset)
recordsetupdatable = True
rstA.MoveFirst
rstA.MoveLast
rstA.MoveFirst
With rstA
Do Until .EOF
rstB.FindFirst "[site] = '" & !site & "' AND [yr] = " & !yr & " AND [productName] = '" & !productName & "' "
If rstB.NoMatch Then
rstB.AddNew
rstB!site = !site
rstB!yr = !yr
rstB!productName = !productName
Else
rstB.Edit
rstB!site = !site
rstB!yr = !yr
rstB!productName = !productName
End If
Select Case !mo
Case "Jan"
rstB!jan = !productPercentage
Case "Feb"
rstB!feb = !productPercentage
Case "Mar"
rstB!mar = !productPercentage
Case "Apr"
rstB!apr = !productPercentage
Case "May"
rstB!may = !productPercentage
Case "Jun"
rstB!jun = !productPercentage
Case "Jul"
rstB!jul = !productPercentage
Case "Aug"
rstB!aug = !productPercentage
Case "Sep"
rstB!sep = !productPercentage
Case "Oct"
rstB!Oct = !productPercentage
Case "Nov"
rstB!nov = !productPercentage
Case "Dec"
rstB!dec = !productPercentage
End Select
rstB.Update
rstB.Bookmark = rstB.LastModified
.MoveNext
loopcount = loopcount + 1
If loopcount Mod 100 = 0 Then
DoCmd.Echo True, 1
End If
Loop
End With