This is somewhat of a follow up to a question I posted yesterday about prompting the user to select a database. I have been able to get the NotesUIWorkspace.Prompt method to work just fine with the PROMPT_CHOOSEDATABASE type. It returns a variant array of 3 strings containing the server, the path and title of the database selected. From there, I populate a few fields. However, I’ve hit a roadblock when the user presses Cancel. When they do, the variant variable is not considered an array anymore, it’s just considered a string. My problem is that I need to handle for this in my code. I’ve tried creating an If statement like this:
If Not variant ( 1 ) = “” Then
code when database selected
else
code if user pressed Cancel
end if
The if statement works if the user selected a database, but the code doesn’t work if they pressed cancel because now my variant variable is not an array. I’ve tried different combinations in my If comparison statement, but I can’t get it to work. Does anybody know how I can get it to work?
Sorry, for directing you in wrong direction in my other post.Here’s the code, which’ll work with out an error:
Dim ws As New NotesUIWorkspace
Dim uidoc As notesuidocument
Set uidoc = ws.currentdocument
Dim tmplist
tmplist = ws.Prompt(13, "Database", "Please pick the database", "")
If Typename(tmplist) = "STRING( )" Then
uidoc.FieldSetText "Server", tmplist(0)
uidoc.FieldSetText "Path", tmplist(1)
uidoc.FieldSetText "Title", tmplist(2)
End If