jforget1
asked on
"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("Windo wSizePickK eywords", "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("payrol l_title", tmpArr(0))
End Sub
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("Windo
tmpArr = ws.PickListstrings( 3, False, db.server , db.fileName , "PayrollTitles" , "Payroll Titles" , "Please choose a payroll title for this user.", 1, "")
Call uiDoc.fieldsettext("payrol
End Sub
Some suggestions:
- you do this in a document that's open for editing??
- use db.FilePath, not db.FileName
- you do this in a document that's open for editing??
- use db.FilePath, not db.FileName
ASKER
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("payrol l_title", tmpArr(0))
Call uiDoc.fieldsettext("payrol
ASKER
" you do this in a document that's open for editing??"
Yes it is in edit mode.
Yes it is in edit mode.
tmpArr(0) may not have value.
so.. before Call uiDoc.fieldsettext("payrol l_title", tmpArr(0)) this, add..
if (isempty(tmpArr)) then
msgbox "Please select value"
exit sub
end if
so.. before Call uiDoc.fieldsettext("payrol
if (isempty(tmpArr)) then
msgbox "Please select value"
exit sub
end if
ASKER
What if they just want to cancel and not choose a value, will this code help that.
yes..it will help
ASKER
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("Windo wSizePickK eywords", "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("payrol l_title", tmpArr(0))
If (Isempty(tmpArr)) Then
Msgbox "Please select value or Cancel"
Exit Sub
End If
End Sub
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("Windo
tmpArr = ws.PickListstrings( 3, False, db.server , db.filePath , "PayrollTitles" , "Payroll Titles" , "Please choose a payroll title for this user.", 1, "")
Call uiDoc.fieldsettext("payrol
If (Isempty(tmpArr)) Then
Msgbox "Please select value or Cancel"
Exit Sub
End If
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This worked, I ended up taking out the MsgBox but the rest of the code worked. Thanks for the help.
Have you run this in debug Mode ?
I hope this helps !