adspmo
asked on
Variant does not contain a container error
HI
This used to work and no when I am testing it with a variety of ID's it is giving me an error
If Not doc Is Nothing Then
If note.type(0) = "Vac" And Month(note.StartDate(0)) > 6 Then
doc.TotalDaysOffCalc = note.TotalDaysOff(0)
doc.RemainingCalc = doc.TotalAH(0) - doc.TotalDaysOffCalc(0)
Else
If doc.CarriedOverAH(0)= note.NewDaysTotal(0) Then
doc.CarriedOverAH = doc.CarriedOverAH(0) - note.NewDaysTotal(0)
doc.TotalDaysOffCalc = note.TotalDaysOff(0)
doc.RemainingCalc = doc.TotalAH(0) - doc.TotalDaysOffCalc(0)
REM Goto SaveIt ' Skip normal calc and save the doc
Else
If doc.CarriedOverAH(0) = 0 Then
doc.TotalDaysOffCalc = note.TotalDaysOff(0)
doc.RemainingCalc = doc.TotalAH(0) - doc.TotalDaysOffCalc(0)
End If
End If
End If
Thanx
James
This used to work and no when I am testing it with a variety of ID's it is giving me an error
If Not doc Is Nothing Then
If note.type(0) = "Vac" And Month(note.StartDate(0)) > 6 Then
doc.TotalDaysOffCalc = note.TotalDaysOff(0)
doc.RemainingCalc = doc.TotalAH(0) - doc.TotalDaysOffCalc(0)
Else
If doc.CarriedOverAH(0)= note.NewDaysTotal(0) Then
doc.CarriedOverAH = doc.CarriedOverAH(0) - note.NewDaysTotal(0)
doc.TotalDaysOffCalc = note.TotalDaysOff(0)
doc.RemainingCalc = doc.TotalAH(0) - doc.TotalDaysOffCalc(0)
REM Goto SaveIt ' Skip normal calc and save the doc
Else
If doc.CarriedOverAH(0) = 0 Then
doc.TotalDaysOffCalc = note.TotalDaysOff(0)
doc.RemainingCalc = doc.TotalAH(0) - doc.TotalDaysOffCalc(0)
End If
End If
End If
Thanx
James
ASKER
I have a feeling this is an edit rights issue
On the Leave Tracking form I have an EditRights field
and the Approvers name is not listed
On the Leave Tracking form I have an EditRights field
and the Approvers name is not listed
ASKER
Forgot to mention
this is the line
doc.TotalDaysOffCalc = note.TotalDaysOff(0)
James
this is the line
doc.TotalDaysOffCalc = note.TotalDaysOff(0)
James
Just add these lines :
on the beginning of the code:
On error goto errortrap:
after the code ends and before the end suhb:
have somethign like this
exit sub
errortrap:
msgbox "Error occurred on line number " & erl & " error is " & error
exit sub
on the beginning of the code:
On error goto errortrap:
after the code ends and before the end suhb:
have somethign like this
exit sub
errortrap:
msgbox "Error occurred on line number " & erl & " error is " & error
exit sub
This is to find out where the error occurs, so that we can give u a proper answer
Partha
Partha
If you are having author access rights, then the error would meniton about insufficient rights. But it is code referencing a field value without that being on the document.
I believe it is note.TotalDaysOff(0) which is causing problem, where you are referencing the index value without the TotalDaysOff on the note document.
1. Check the spelling of the field being referenced.. is this field physically on the document or created via script ?
2. msg out the vaue like this Msgbox cstr(note.TotalDaysOff(0))
I believe it is note.TotalDaysOff(0) which is causing problem, where you are referencing the index value without the TotalDaysOff on the note document.
1. Check the spelling of the field being referenced.. is this field physically on the document or created via script ?
2. msg out the vaue like this Msgbox cstr(note.TotalDaysOff(0))
ASKER
WEll I added the message box and it came up with a valu once and after that it was variant blabla...
Here is formula forTotalDaysOff
Requested :=NewDaysTotal; "Another field that calculates only weekdays
Booked := @DbLookup( "" : "NoCache" ;""; "AvailHol" ; profile_key;"TotalDaysOffC alc");
Total :=Requested + Booked;
Total1:= HalfDayCalc + Booked; HalfDayCalc is another field for half day holiday
@If(ApprovalStatus ="Draft";0;HalfDaySel ="";Total;HalfDayCalc != 1; Total1;Total)
Here is formula forTotalDaysOff
Requested :=NewDaysTotal; "Another field that calculates only weekdays
Booked := @DbLookup( "" : "NoCache" ;""; "AvailHol" ; profile_key;"TotalDaysOffC
Total :=Requested + Booked;
Total1:= HalfDayCalc + Booked; HalfDayCalc is another field for half day holiday
@If(ApprovalStatus ="Draft";0;HalfDaySel ="";Total;HalfDayCalc != 1; Total1;Total)
ASKER
Well
When I look at the document properties box I see a
ServerError Entry not found in index
If I refresh the form alworks well
I guess we need to refresh the form
James
When I look at the document properties box I see a
ServerError Entry not found in index
If I refresh the form alworks well
I guess we need to refresh the form
James
Change this formula to more error proof
Requested :=NewDaysTotal; "Another field that calculates only weekdays
Booked := @DbLookup( "Notes" : "NoCache" ;@DBName; "AvailHol" ; profile_key;"TotalDaysOffC alc");
@if(@IsError(Booked); @Return(0); "");
Total :=Requested + Booked;
Total1:= HalfDayCalc + Booked; HalfDayCalc is another field for half day holiday
@If(ApprovalStatus ="Draft";0;HalfDaySel ="";Total;HalfDayCalc != 1; Total1;Total)
Requested :=NewDaysTotal; "Another field that calculates only weekdays
Booked := @DbLookup( "Notes" : "NoCache" ;@DBName; "AvailHol" ; profile_key;"TotalDaysOffC
@if(@IsError(Booked); @Return(0); "");
Total :=Requested + Booked;
Total1:= HalfDayCalc + Booked; HalfDayCalc is another field for half day holiday
@If(ApprovalStatus ="Draft";0;HalfDaySel ="";Total;HalfDayCalc != 1; Total1;Total)
ASKER
I still get the Server Error Entry.....
i did add
Sub Querymodechange(Source As Notesuidocument, Continue As Variant)
If Source.EditMode Then Call Source.Refresh
End Sub
It does not seem to work, I need to manually press F9
Any ideas
i did add
Sub Querymodechange(Source As Notesuidocument, Continue As Variant)
If Source.EditMode Then Call Source.Refresh
End Sub
It does not seem to work, I need to manually press F9
Any ideas
justa suggestoin
Have the form property , automatically refresh fields enabled.
Partha
Have the form property , automatically refresh fields enabled.
Partha
ASKER
That property is marked of and has always been
What is the datatype of field TotalDaysOff. If it is dialog list or list box, then u can enable refresh fields on keywords change
Partha
Partha
ASKER
It is a number field
It's confusing, what is the value whicih gets populated when u refresh
Partha
Partha
ASKER
It all depends on what the @If evaluates to either Total or Total1
There must be a way to force a refresh???
Requested :=NewDaysTotal;
Booked := @DbLookup( "" : "NoCache" ;""; "AvailHol" ; profile_key;"TotalDaysOffC alc");
@If(@IsError(Booked); @Return(0); "");
Total :=Requested + Booked;
Total1:= HalfDayCalc + Booked;
@If(ApprovalStatus ="Draft";0;HalfDaySel ="";Total;HalfDayCalc != 1; Total1;Total)
There must be a way to force a refresh???
Requested :=NewDaysTotal;
Booked := @DbLookup( "" : "NoCache" ;""; "AvailHol" ; profile_key;"TotalDaysOffC
@If(@IsError(Booked); @Return(0); "");
Total :=Requested + Booked;
Total1:= HalfDayCalc + Booked;
@If(ApprovalStatus ="Draft";0;HalfDaySel ="";Total;HalfDayCalc != 1; Total1;Total)
Requested :=NewDaysTotal;
Booked := @DbLookup( "" : "NoCache" ;""; "AvailHol" ; profile_key;"TotalDaysOffC
@If(@IsError(Booked); @Return(0); "");
Total :=Requested + Booked;
Total1:= HalfDayCalc + Booked;
@If(ApprovalStatus ="Draft";0;HalfDaySel ="";Total;HalfDayCalc != 1; Total1;Total) ;
@command([viewrefreshfield
Partha
ASKER
Boy do I feel dumb. One of the fields that the formula was referring to was after the field listed above ergo the formula had to be forced to refresh
Live and learn
Live and learn
have a similar field with similar formula hidden on top of the form with a different name. Use this name for reference.
ASKER
Boy do I feel dumb. One of the fields that the formula was referring to was after the field listed above ergo the formula had to be forced to refresh
Live and learn
Live and learn
now you have refreshed this page to get second comment of the same kind....
What is the field type .. Computed ?
What is this profie_key ? And how is this document created ?
If this document is created by a script and approver opens it later, then use ComputeWithForm to calculcate all the formula for fields !!
What is this profie_key ? And how is this document created ?
If this document is created by a script and approver opens it later, then use ComputeWithForm to calculcate all the formula for fields !!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
basically, what the error means is that you are referencing a variant value where the variant itself is empty or doesnot exist. In your case it could be that the fields are not available on the document
~Hemanth