"Variant does not contain a container" error

I  am getting an "Variant does not contain a container" error. How do I give my new code a container, just want to help it out. :>)

Sub Click(Source As Button)
     Dim s As New notessession
     Dim db As notesdatabase
     Set db = s.currentdatabase
     Dim ws As New notesuiworkspace
     Dim uiDoc As notesuiDocument
     Set uiDoc = ws.currentdocument
     Dim tmpArr As Variant
     
     Call s.SetEnvironmentVar("WindowSizePickKeywords", "171 142 736 553", True)
     tmpArr = ws.PickListstrings( 3, False, db.server , db.fileName , "PayrollTitles" , "Payroll Titles" , "Please choose a payroll title for this user.", 1, "")
     Call uiDoc.fieldsettext("payroll_title", tmpArr(0))
     
End Sub
jforget1Asked:
Who is Participating?
 
madheeswarConnect With a Mentor Commented:
Try this:

Sub Click(Source As Button)
     Dim s As New notessession
     Dim db As notesdatabase
     Set db = s.currentdatabase
     Dim ws As New notesuiworkspace
     Dim uiDoc As notesuiDocument
     Set uiDoc = ws.currentdocument
     Dim tmpArr As Variant
     
     Call s.SetEnvironmentVar("WindowSizePickKeywords", "171 142 736 553", True)
     tmpArr = ws.PickListstrings( 3, False, db.server , db.filePath , "PayrollTitles" , "Payroll Titles" , "Please choose a payroll title for this user.", 1, "")
If (Isempty(tmpArr)) Then
          Msgbox "Please select value or Cancel"          
          Exit Sub
     End If

     Call uiDoc.fieldsettext("payroll_title", tmpArr(0))
     End Sub
0
 
SysExpertCommented:
On what line is the  error occurri ?

Have you run this in  debug Mode ?

I hope this helps !
0
 
Sjef BosmanGroupware ConsultantCommented:
Some suggestions:
- you do this in a document that's open for editing??
- use db.FilePath, not db.FileName
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
jforget1Author Commented:
Sorry, forgot to add that, it is happening at the line below. Maybe because there is nothing to put into the field.

Call uiDoc.fieldsettext("payroll_title", tmpArr(0))
0
 
jforget1Author Commented:
" you do this in a document that's open for editing??"

Yes it is in edit mode.
0
 
madheeswarCommented:
tmpArr(0) may not have value.
so.. before Call uiDoc.fieldsettext("payroll_title", tmpArr(0)) this, add..

if (isempty(tmpArr)) then
msgbox "Please select value"
exit sub
end if
0
 
jforget1Author Commented:
What if they just want to cancel and not choose a value, will this code help that.
0
 
madheeswarCommented:
yes..it will help
0
 
jforget1Author Commented:
I added the code suggested but still get the error when hitting cancel, do I have this in the proper place?

Sub Click(Source As Button)
      Dim s As New notessession
      Dim db As notesdatabase
      Set db = s.currentdatabase
      Dim ws As New notesuiworkspace
      Dim uiDoc As notesuiDocument
      Set uiDoc = ws.currentdocument
      Dim tmpArr As Variant
      
      Call s.SetEnvironmentVar("WindowSizePickKeywords", "171 142 736 553", True)
      tmpArr = ws.PickListstrings( 3, False, db.server , db.filePath , "PayrollTitles" , "Payroll Titles" , "Please choose a payroll title for this user.", 1, "")
      Call uiDoc.fieldsettext("payroll_title", tmpArr(0))
      If (Isempty(tmpArr)) Then
            Msgbox "Please select value or Cancel"            
            Exit Sub
      End If
End Sub
0
 
jforget1Author Commented:
This worked, I ended up taking out the MsgBox but the rest of the code worked. Thanks for the help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.