I have the following script on a button to check the answers to questions. When the answer is wrong I am writing “Incorrect” in a computed field. This does write if the score is below 70%, and then if they change answers and their score is 70% or over the value does not show anymore. If the first time they hit the button and their score is 70% or above it shows the incorrect value for a second but then the value disappears and does not show when you open the document again. Any suggestions?
Dim session As New NotesSession
Dim db As NotesDatabase
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim score As Double
Dim askme As String
Dim doc As NotesDocument
Dim correct As Double
Dim item As NotesItem
Dim arraycount As Double
Dim answer As Double
Dim iscore As Double
Dim MTotal As String
Dim fieldname As String
Dim aname As String
Dim rtitem As NotesRichTextItem
Dim senddoc As NotesDocument
Dim sTo(1) As String
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document
Call uidoc.Refresh
sTo(0) = uidoc.FieldGetText(“SendTo”)
sTo(1) = uidoc.FieldGetText(“Manager”)
score = uidoc.FieldGetText(“Total”)
MTotal = uidoc.FieldGetText(“Total”)
For arraycount = 1 To 7
fieldname = “a” & arraycount
aname = “c” & arraycount
iscore = Cdbl(uidoc.FieldGetText(fieldname))
If iscore = 0 Then
Set item = doc.ReplaceItemValue(aname,“INCORRECT”)
End If
Next
If score < .70 Then
askme = workspace.Prompt(PROMPT_OK,“Score”,“Your score is below 70% please check your answers”)
Exit Sub
End If
If score > .69 Then
askme = workspace.Prompt(PROMPT_OK,“Score”,"Congratulations, your score is " & MTotal)
Call uidoc.Save
Set db = session.CurrentDatabase
Set senddoc = db.CreateDocument
Set rtitem = New NotesRichTextItem(senddoc, “Body”)
senddoc.form = “Memo”
senddoc.Subject = doc.Test(0)
Call rtitem.AppendText(doc.Name(0) &" has taken the above quiz")
Call rtitem.AddNewline(2)
Call rtitem.AppendText("Quiz score is " & MTotal)
Call senddoc.Send(False,sTo)
End If
Call uidoc.Refresh
Call uidoc.FieldSetText(“Status”,“Done”)
Call uidoc.Save
uidoc.EditMode = False
uidoc.Close(True)
Thanks again