williadn48
Programmer
This code works fine after a few minutes. If I leave the web page up and running for a long time (there is a hidden timer in the background), some of the variables go missing causing an Out of Present Range error. The holdstarttime session variable gets populated with now() when I click a start button earlier in the session. Yes, there is a date and time in that session variable initially. But if I wait an hour or so, and come back to the session and click stop, the holdstarttime session variable is empty.
if Request.form("hdnAction") = "Stop" then
dim theTimeatStop
theTimeatStop = now()
dim theTimeToComplete
dim hStartTime
hStartTime = Session("holdstarttime")
theTimeToComplete = DateDiff("s",hStartTime,theTimeatStop)
set cmdUPDATE = Server.CreateObject("ADODB.command")
cmdUPDATE.ActiveConnection = strCONN_DATA
cmdUPDATE.CommandText = "[sp_New_Update_tblECMTimeTrackingMain]"
cmdUPDATE.CommandType = 4
set param = cmdUPDATE.CreateParameter("@Associate",129,1,6)
cmdUPDATE.Parameters.Append param
set param = cmdUPDATE.CreateParameter("@EndTime",135,1,8)
cmdUPDATE.Parameters.Append param
set param = cmdUPDATE.CreateParameter("@TransxStatus",129,1,50)
cmdUPDATE.Parameters.Append param
set param = cmdUPDATE.CreateParameter("@QCBatches",129,1,4)
cmdUPDATE.Parameters.Append param
set param = cmdUPDATE.CreateParameter("@Comments",129,1,5000)
cmdUPDATE.Parameters.Append param
set param = cmdUPDATE.CreateParameter("@SecondsElapsed",3,1,4)
cmdUPDATE.Parameters.Append param
'cmdUPDATE.Parameters(0) = strRowID
cmdUPDATE.Parameters(0) = trim(Request.Cookies("cUSERID"))
cmdUPDATE.Parameters(1) = theTimeatStop
cmdUPDATE.Parameters(2) = "Function Completed"
cmdUPDATE.Parameters(3) = meBatches
cmdUPDATE.Parameters(4) = meComments
cmdUPDATE.Parameters(5) = theTimetoComplete
cmdUPDATE.Execute lngRECS,,128
meFUNCAREA = "0"
meSUBFUNC = "0"
meBatches = 0
veBatches = 0
meComments = ""
end if
if Request.form("hdnAction") = "Stop" then
dim theTimeatStop
theTimeatStop = now()
dim theTimeToComplete
dim hStartTime
hStartTime = Session("holdstarttime")
theTimeToComplete = DateDiff("s",hStartTime,theTimeatStop)
set cmdUPDATE = Server.CreateObject("ADODB.command")
cmdUPDATE.ActiveConnection = strCONN_DATA
cmdUPDATE.CommandText = "[sp_New_Update_tblECMTimeTrackingMain]"
cmdUPDATE.CommandType = 4
set param = cmdUPDATE.CreateParameter("@Associate",129,1,6)
cmdUPDATE.Parameters.Append param
set param = cmdUPDATE.CreateParameter("@EndTime",135,1,8)
cmdUPDATE.Parameters.Append param
set param = cmdUPDATE.CreateParameter("@TransxStatus",129,1,50)
cmdUPDATE.Parameters.Append param
set param = cmdUPDATE.CreateParameter("@QCBatches",129,1,4)
cmdUPDATE.Parameters.Append param
set param = cmdUPDATE.CreateParameter("@Comments",129,1,5000)
cmdUPDATE.Parameters.Append param
set param = cmdUPDATE.CreateParameter("@SecondsElapsed",3,1,4)
cmdUPDATE.Parameters.Append param
'cmdUPDATE.Parameters(0) = strRowID
cmdUPDATE.Parameters(0) = trim(Request.Cookies("cUSERID"))
cmdUPDATE.Parameters(1) = theTimeatStop
cmdUPDATE.Parameters(2) = "Function Completed"
cmdUPDATE.Parameters(3) = meBatches
cmdUPDATE.Parameters(4) = meComments
cmdUPDATE.Parameters(5) = theTimetoComplete
cmdUPDATE.Execute lngRECS,,128
meFUNCAREA = "0"
meSUBFUNC = "0"
meBatches = 0
veBatches = 0
meComments = ""
end if