This topic is locked

AfterEdit return

6/16/2006 3:38:18 PM
ASPRunnerPro General questions
B
barljo00 author

I have another problem that I posted a couple of weeks ago, but it seems to have disappeared with the Hackers!! One of my pages has a lot of Before & After Edit logic. I'm spinning thru a series of records creating new records based on what has been done on the edit. I've displayed messages showing that I've gotten to the various parts of the code. My last Response.Write before ending the AfterEdit states that I got to the end. When it returns to the Edit module, I get an abend. The error seems to point to a bogus address. Everything has been updated correctly and currently I just click the Back to list to get out of it, but I can't turn this over to the users.
Here is my code for the AfterEdit:
'Session("ProjDR_UsedInd")

Response.Write "; After Used Ind = " & Session("ProjDR_UsedInd")
if Session("ProjDR_UsedInd") = "on" then

Response.Write "; After Used Ind = " & Session("ProjDR_UsedInd")

else
'*****need to create a Monthly_ProjectDRPoints for 1st month

' Format of strProjDR_DateAdded is MM/DD/YYYY
strCurrentYYYYMM = right(Session("strProjDR_DateAdded"),4) & left(Session("strProjDR_DateAdded"),2)

iCurrentYYYY = right(Session("strProjDR_DateAdded"),4)

iCurrentMM = left(Session("strProjDR_DateAdded"),2)

Response.Write "; strCurrentYYYYMM = " & strCurrentYYYYMM & " and strProjDR_DateAdded = " & Session("strProjDR_DateAdded")

iCurrentYYYYMM = strCurrentYYYYMM
iYYYYplus1 = left(Session("strYYYYMMplus1"),4)

strMMplus1 = right(Session("strYYYYMMplus1"),2)
strSQL = "select * from qMonthlyRelsYYYYMM where Release = " & Session("iProjectRelease")
set rsYYYYMM = CreateObject("ADODB.Recordset")
rsYYYYMM.Open strSQL, dbConnection
do while not rsYYYYMM.eof

Response.Write "; Found MonthlyRELSYYYYMM "
' Process all YYYY/MM for this D/R from today until projected completion

iYM = rsYYYYMM("RelYYYYMM")

iYM_ID = rsYYYYMM("RelYYYYYMM_ID")

Response.Write "; iYM = " & iYM & " and iYM_ID = " & iYM_ID & " and iYYYYMMplus1 = " & Session("iYYYYMMplus1")
if iYM = iCurrentYYYYMM then

strDate_Release = iYM_ID & "/" & Session("iProjectRelease")
strSQLInsert = "insert into Monthly_ProjectDRPoints ("

strSQLInsert = strSQLInsert & "PDRM_NewDate, "

strSQLInsert = strSQLInsert & "ProjDR_ID, "

strSQLInsert = strSQLInsert & "PRCost_Month, "

strSQLInsert = strSQLInsert & "ProjRelID) "
strSQLInsert = strSQLInsert & " values ("
strSQLInsert = strSQLInsert & "'" & Session("strProjDR_InitialPlannedCompletionDate") & "', "

strSQLInsert = strSQLInsert & Session("iProjDR_ID") & ", "

strSQLInsert = strSQLInsert & iYM_ID & ", "
strSQLInsert = strSQLInsert & Session("iProjectRelease") & ")"
Response.Write "; strSQLInsert = " & strSQLInsert
dbConnection.Execute strSQLInsert

end if
rsYYYYMM.MoveNext

loop
rsYYYYMM.Close : set rsYYYYMM = Nothing
Response.Write "; after edit done"

end if
Here is the result, with all the displays:
After Used Ind = ; strCurrentYYYYMM = 200606 and strProjDR_DateAdded = 06/16/2006; Found MonthlyRELSYYYYMM ; iYM = 200606 and iYM_ID = 221 and iYYYYMMplus1 = 200607; strSQLInsert = insert into Monthly_ProjectDRPoints (PDRM_NewDate, ProjDR_ID, PRCost_Month, ProjRelID) values ('2006-6-30', 143, 221, 147); Found MonthlyRELSYYYYMM ; iYM = 200607 and iYM_ID = 222 and iYYYYMMplus1 = 200607; Found MonthlyRELSYYYYMM ; iYM = 200608 and iYM_ID = 223 and iYYYYMMplus1 = 200607; Found MonthlyRELSYYYYMM ; iYM = 200609 and iYM_ID = 224 and iYYYYMMplus1 = 200607; Found MonthlyRELSYYYYMM ; iYM = 200610 and iYM_ID = 225 and iYYYYMMplus1 = 200607; Found MonthlyRELSYYYYMM ; iYM = 200611 and iYM_ID = 226 and iYYYYMMplus1 = 200607; Found MonthlyRELSYYYYMM ; iYM = 200612 and iYM_ID = 227 and iYYYYMMplus1 = 200607; Found MonthlyRELSYYYYMM ; iYM = 200701 and iYM_ID = 228 and iYYYYMMplus1 = 200607; Found MonthlyRELSYYYYMM ; iYM = 200702 and iYM_ID = 229 and iYYYYMMplus1 = 200607; Found MonthlyRELSYYYYMM ; iYM = 200703 and iYM_ID = 230 and iYYYYMMplus1 = 200607; Found MonthlyRELSYYYYMM ; iYM = 200704 and iYM_ID = 231 and iYYYYMMplus1 = 200607; after edit done

Go to D/R Points, Edit record [ProjDR_ID: 143, ProjDR_D_R_Point: 2, ProjectRelease: 147]

<<< Record updated >>>

____

Back to list
ADODB.Recordset error '800a0cc1'

Item cannot be found in the collection corresponding to the requested name or ordinal.

/hsQR/SETDMeetings/PWT_Project/Project_DR_Points_edit.asp, line 464
Here is the code for the part that seems to be the abend:

if IsUpdatable(rs.Fields("ProjDR_UsedInd")) then

nType = GetFieldType(strTableName, "ProjDR_UsedInd")

strValue=dict("ProjDR_UsedInd")

if GetEditFormat("ProjDR_UsedInd")=EDIT_FORMAT_FILE then

if GetRequestForm("typeProjDR_UsedInd") = "upload2" then

rs("ProjDRUsedInd")= strValue

if strValue<>"" then


WriteToFile Server.MapPath(GetUploadFolder("ProjDR_UsedInd") & strValue), GetRequestForm("fileProjDR_UsedInd")

end if

elseif GetEditFormat("ProjDR_UsedInd")<>FORMAT_DATABASE_IMAGE and GetEditFormat("ProjDR_UsedInd")<>FORMAT_DATABASE_FILE then

if IsFloat(nType) and strValue<>"" then

===>>> Line 464 rs("ProjDR_UsedInd") = CSmartDbl(strValue)

else

rs("ProjDR_UsedInd") = strValue

end if
else

if GetRequestForm("typeProjDR_UsedInd") = "file1" or GetRequestForm("typeProjDR_UsedInd") = "file2" then

If IsNull(strValue) or GetRequestForm("typeProjDR_UsedInd") = "file1" Then

rs("ProjDR_UsedInd") = Null

Else

rs("ProjDR_UsedInd").AppendChunk strValue

End If

end if

end if

end if
Tks,

Joan

Sergey Kornilov admin 6/18/2006

It looks like strSQL varibale that you use overwrites the value of strSQL on the Edit page.
Try to use another variable name or in the beginning of your code define local variable:

Dim strSQL