J
James Baker
I'm getting an error: "Operation is not allowed when the object is closed."
on the lines of code below. I can't imagine why the object would be closed
where it says it will be, I've just opened it on the line before. This is
all within a larger loop, but the loop seems to be working fine and other
insert statements within it seem ok. Any suggestions?
Dim cmsRS, cmsSQL
Dim insRS, insSQL
Set cmsRS = Server.CreateObject("ADODB.Recordset")
Set insRS = Server.CreateObject("ADODB.Recordset")
cmsSQL = "SELECT ClientsFileNumber FROM TblOrder WHERE FileNumber = '" &
Request.Form("ref" & intR) & "' AND ClientCode = 'CMSNY'"
cmsRS.Open cmsSQL, "DSN=kasecure1;uid=sa;pwd=pcbs"
If NOT cmsRS.EOF Then
insSQL = "INSERT INTO CMS (FileNumber, StatusDate, StatusTime,
StatusComment) VALUES('" & Request.Form("ref" & intR) & "', '" &
Request.Form("sd" & intR & "_" & intsc & "', '" & adstime & "', 'Inspection
Date has been set for " & isd & "')"
' / Begin Problem
insRS.Open insSQL, "DSN=kasecure1;uid=sa;pwd=pcbs"
insRS.Close ' Errors on this line
' / End Problem
End If
cmsRS.Close
Set cmsRS = Nothing
Set insRS = Nothing
on the lines of code below. I can't imagine why the object would be closed
where it says it will be, I've just opened it on the line before. This is
all within a larger loop, but the loop seems to be working fine and other
insert statements within it seem ok. Any suggestions?
Dim cmsRS, cmsSQL
Dim insRS, insSQL
Set cmsRS = Server.CreateObject("ADODB.Recordset")
Set insRS = Server.CreateObject("ADODB.Recordset")
cmsSQL = "SELECT ClientsFileNumber FROM TblOrder WHERE FileNumber = '" &
Request.Form("ref" & intR) & "' AND ClientCode = 'CMSNY'"
cmsRS.Open cmsSQL, "DSN=kasecure1;uid=sa;pwd=pcbs"
If NOT cmsRS.EOF Then
insSQL = "INSERT INTO CMS (FileNumber, StatusDate, StatusTime,
StatusComment) VALUES('" & Request.Form("ref" & intR) & "', '" &
Request.Form("sd" & intR & "_" & intsc & "', '" & adstime & "', 'Inspection
Date has been set for " & isd & "')"
' / Begin Problem
insRS.Open insSQL, "DSN=kasecure1;uid=sa;pwd=pcbs"
insRS.Close ' Errors on this line
' / End Problem
End If
cmsRS.Close
Set cmsRS = Nothing
Set insRS = Nothing