R5 DialogBox bug

There's a bug with R5 which causes files to close when the DialogBox function is used. For example: A text file has been opened and is being used for data retrieval. When the BEFORE script below is evaluated, the user is prompted with the Dialogbox and then clicks OK or CANCEL. Regardless of the user's selection, the text file will be closed and the preceeding process will cause a "File Not Open" error. A solution around this is to use the new PROMPT function in R5 to replace Dialogbox. However, this new PROMPT script will not work in previous versions. So the solution is to check the version of Notes currently being used, use DIALOGBOX if R4 and PROMPT if R5 or higher.
LotusScript

BEFORE

If ws.Dialogbox("Dialog: Update Existing YesNoAll", True, True, True , False, False, False, title ,Ddoc)  Then
    UpdatePrompt = Ddoc.UpdateResult(0)
Else
    UpdatePrompt =  "No"
End If 


AFTER

     If Left(session.notesversion, 9) = "Release 4" Then
          If ws.Dialogbox("Dialog: Update Existing YesNoAll", True, True, True , False, False, False, title ,Ddoc)  Then
               UpdatePrompt = Ddoc.UpdateResult(0)
          Else
               UpdatePrompt =  "No"
          End If  
     Else
          Dim values(2) As String
          values(0) = "Update this document"
          values(1) = "Update all existing documents"
          values(2) = "Do not update this document"
          
          Dim answer As String
          answer = ws.Prompt( PROMPT_OKCancelList, "Update Existing Document?", title, "" , Values )
          
          If answer = "Update this document" Then
               UpdatePrompt = "Yes"
          Elseif answer = "Update all existing documents"  Then
               UpdatePrompt = "All"
          Else
               UpdatePrompt = "No"
          End If
     End If

Posted by fbrefere001 on Monday June 18, 2001