I’m having trouble adding new rows to this table when there are existing rows. If I drop the entire table first I can loop through and add all records successfully, but when I condition the DELETE so there are records left in the table the agent errors out when it gets to the result.updaterow.
Has anyone else run into this problem and/or know a solution?
qry.SQL = “DELETE FROM Ticket_ARMS where Ticket_ID is not null”
result.Execute
qry.SQL = “SELECT * FROM Ticket_ARMS”
result.Execute
Set doc = view.GetFirstDocument
While Not(doc Is Nothing)
result.AddRow
Call result.SetValue(“DocID”,doc.universalid)
Call result.SetValue("SSN",Left$(doc.SocialSecurityNumber(0),9))
Call result.SetValue("RequestNumber",Left$(doc.RequestNumber(0),8))
Call result.SetValue("LastName",Left$(doc.lastname(0),30))
Call result.SetValue("FirstName",Left$(doc.firstname(0),20))
Call result.SetValue("MiddleName",Left$(doc.middlename(0),20))
Call result.SetValue("ManagerName",Left$(doc.managername_1(0),50))
Call result.SetValue("NewUserID",Left$(doc.newuserid(0),20))
Call result.SetValue("DeleteAccess",Left$(doc.deleteaccs(0),20))
Call result.SetValue("AddAccess",Left$(doc.addaccs(0),20))
Call result.SetValue("Transfer",Left$(doc.transfer(0),20))
Call result.SetValue("NameChange",Left$(doc.namechange(0),20))
Call result.SetValue("PreviousName",Left$(doc.previousname(0),20))
Call result.SetValue("UserIDAssigned",Left$(doc.useridassigned(0),8))
Call result.SetValue("RetailName",Left$(doc.retailname(0),50))
Call result.SetValue("RetailBank",Left$(doc.retailbank(0),10))
Call result.SetValue("RetailBranch",Left$(doc.retailbranch(0),10))
Call result.SetValue("NonRetailModel",Left$(doc.nonretailmodel(0),50))
Call result.SetValue("LotusBankNum",Left$(doc.lotusbanknum(0),10))
Call result.SetValue("LotusBranchNum",Left$(doc.lotusbranchnum(0),10))
Call result.SetValue("LotusExpDate",Left$(doc.lotusexpdate(0),10))
Call result.SetValue("INotesBankNum",Left$(doc.inotesbanknum(0),10))
Call result.SetValue("INotesBranchNum",Left$(doc.inotesbranchnum(0),10))
Call result.SetValue("RequestType",Left$(doc.requesttype(0),50))
result.UpdateRow
Set doc = view.GetNextDocument(doc)
Wend
result.Close(DB_CLOSE)
con.Disconnect