In database one I have LS to create a document in database two. The code is below. This has been running fine for about a year. It was just reported that if they click the button with the code, then the document will be created, fields will be filled in, but an error box with IBM Error “#0C:02” will display, it will also stop the rest of the code from the button push.
I have searched the forum but have not found any solutions.
Code in button:
@If(CQAcreated = “Yes”; @Prompt([Ok];“CQA Created”; “A CQA has already been created for this complaint.”) : @Return(“”) ;“”);
@Command([RunAgent];“(CreateCQA)”);
@SetField(“complstatus”; complstatus : ("CQA Created – " + @Text(@Today) + " by " + @Name([CN];@UserName)));
@If(CQAcreated = “Yes”;“”;@SetField(“CQAcreated”;“Yes”));
@SetField(“Cause_1”;“100 - See CQA”)
Code for the RunAgent command within button code
Sub Initialize
Dim workspace As New notesuiworkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Dim CC_db As NotesDatabase
Dim doc As notesdocument
Dim CurDoc As NotesDocument
Dim w As NotesUIWorkspace
Dim CQA As Variant
Set w = New NotesUIWorkspace
Set db = session.CurrentDatabase
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.document
Set CC_db = New NotesDatabase("Edison/SEL","qsiqms\CustQualityImprv.nsf")
Set CurDoc = New notesdocument(CC_db)
CurDoc.Form = "CQA" 'declare what form you are using in the CQAdatabase
CurDoc.status = "New"
CurDoc.OpenDate = Today
CurDoc.ProbNumber = doc.ControlNumber(0)
CurDoc.Customer = doc.CompanyName(0)
CurDoc.FindingDate = doc.DateStarted(0)
CurDoc.SerialNumber = doc.Serial
one = uidoc.FieldGetText("MOT")
If one = "" Then
CurDoc.Product = doc.product_2(0)
Else
CurDoc.Product = doc.MOT(0)
End If
CurDoc.ProbStatement = doc.Containment(0)
CurDoc.CC = doc.ControlNumber
CurDoc.RMA = doc.RMA(0)
two = uidoc.FieldGetText("RMA")
If two = "" Then
Else
CurDoc.Type = "RMA"
End If
Call CurDoc.ComputeWithForm(False,False) 'this is put in to compute the auto number
Set uidoc = w.EditDocument(True, CurDoc)
'Call CurDoc.Save(True,False)
End Sub
Update*********
I have now found that the document within the first database will throw this error when ever you make an edit and try to save and exit. Nothing is then saved.
The rest of the documents are behaving as normal.
Thanks in advance for any and all help.
Teri
Subject: A couple of things…
I reviewed the code and noticed a couple of things:
-
In the Option section of the Agent make sure you have an ‘Option Declare’ statement to ensure all variables are declared and correctly used.
-
Implement error handling in the code so if there is an error it gets trapped and displayed accordingly.
Example:
On Error Goto Error_Handler
… your code here …
’ Put the following code just before the Exit Sub of the Initialize event of the agent
Exit Sub ’ ← this must be added before the Error_Handler label
Error_Handler:
Print "An error occurred on line " & Trim(Cstr(Erl)) & “: " & Error$ & " (” & Trim(Cstr(Err)) & “)”
Exit Sub
- Should the following line:
CurDoc.CC = doc.ControlNumber
actually be:
CurDoc.CC = doc.ControlNumber(0)
Set uidoc = w.EditDocument(True, CurDoc)
to
Call w.EditDocument(True, CurDoc)
Alex
Subject: Possible Corruption???
Thanks Alex,
I will put in the error trapping etc. However, I have found that it is not the code that is causing the issue.
The error is happening whenever you open the document for edit and try to save.
I have tested other documents within the db and they are working fine. I have opened the specific document that causes the issue and it is now showing the error when ever you try to save the document.
I had our Admin run a fixup on the database but that did not help.
Any other suggestions?
Thanks
Teri
Subject: #0C:02
I am also getting this message on just one particular document in a database. If I click Edit and then try to Save, whether I have made a change or not, I get this message.
Sidenote: not sure if this helps any new ideas but, within the same document there are several Excel file attachments. I can delete each of them without a problem but every time I try to delete this one particular file it crashes my client. Doesn’t lock it up - completely closes it and I have to wait for it to create the log file. I haven’t found anything in the log file to help me yet.
Please post if you find a solution. Thanks!!
Subject: It’s related to RichText field
I encounted the same problem and finally found it was related to Richtext field.
Notes Error - #0C:02
This problem is related to RichText field, so you can call uidoc.refresh(true) to refresh the rich text field.
the following code maybe cause the problem:
...
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document
If uidoc.EditMode Then
Call uidoc.Refresh (will cause this error)
End If
...
If Not (doc Is Nothing) Then
doc.Field1 = ""
doc.Field2 = ""
...
End If
to solve it, just change the refresh statement:
...
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document
If uidoc.EditMode Then
Call uidoc.Refresh(True)
End If
...
If Not (doc Is Nothing) Then
doc.Field1 = ""
doc.Field2 = ""
...
End If
Subject: #0C:02
All, I am hoping that someone out there has experienced this and found a fix.
I have one person that is experiencing this now on one document on the save and exit then the IBM Lotu Notes error #0C:02 pop’s up. I can reproduce this each time.
It does not happen on any of the other documents within the database.
A year ago when I originally posted this issue, I ended up re-creating the document for the person.
I would prefer to find out what causes this issue and fix that so if anyone has something they can add I would appreciate it.
Cheers,
Teri