Variant does not contain container

when i run the code below it is working fine :

Sub UpdateColumnHeaders( nameOfView As String,Offset As Integer, startdate As Variant )

Dim session As New NotesSession

Dim db As NotesDatabase

Dim view As NotesView

Dim vc As NotesViewColumn

Dim dd As Variant

Dim count As Integer

Dim daycount As Integer

Dim VarColor As String

Dim dat As Variant



Set db = session.CurrentDatabase

Set view = db.GetView(nameOfView)



count = View.ColumnCount													'Count number of columns in the whole view

daycount = (count-offset)/2  - 1												'Prepare the dayscounter (substract offset, then divided by 2 (due to extra color colums)).

Set vc=view.columns(3)

dd = Format$(startdate.lslocaltime,"Short Date")					'set dd to datecount,and force dd/mm/yyyy format

vc.HeaderFontPointSize = 10

vc.HeaderFontStyle = VC_FONT_BOLD

vc.HeaderAlignment = VC_ALIGN_CENTER	

vc.HeaderFontColor = COLOR_BLACK	

vc.IsResize = False

vc.Title = Format$(dd,"mmmm yyyy")

vc.Width = 12					

Do Until count = offset						                                     		'Do until offset reached (see intialize)

	

	Set vc = view.Columns(count-1)   					                   		'Sets the column to be re-designed

	

	dd = Format$(startdate.lslocaltime + daycount,"Short Date")					'set dd to datecount,and force dd/mm/yyyy format

’ vc.FontFace = “Webdings” 'Set default font/header options etc.

	vc.FontFace = "Arial"										   		'Set default font/header options etc.

	vc.Alignment = VC_ALIGN_CENTER

	vc.FontPointSize = 16

	vc.HeaderFontPointSize = 10

	vc.HeaderFontStyle = VC_FONT_BOLD

	vc.HeaderAlignment = VC_ALIGN_CENTER	

	Select Case Weekday(dd)												'Select headerfontcolor by weekday

	Case 1 :  vc.HeaderFontColor = COLOR_RED 

	Case 7 : vc.HeaderFontColor = COLOR_DARK_YELLOW 	'Set to Dark yellow on saturdays

	Case	Else  :vc.HeaderFontColor = COLOR_BLACK			'use black on other days

	End Select

	Select Case Weekday(dd)												'Select headerfontcolor by weekday

	Case 1 :  vc.FontFace = "Webdings"

	Case	Else  :vc.FontFace = "Arial"		

	End Select

	

	vc.Title = Format$(dd,"dd")												'Rename the colum to 2-digit day number dd

	vc.Width = 1																	'(Re-)set width to re-align the view (just in case user messed it up)

	dat = Format$(dd,"dd-mm-yyyy")	

	'Rewrite the date column formula to avoid use of @today (This avoids unneeded refresh of index)

	vc.Formula={""}

	vc.Formula = {tel:=@member("} & dat &{";@explode(absencedaystotal));@if(tel<>0;approved:=@subset(approvetotal;tel);"");@if(tel<>0;approved1:=@subset(approved;-1);"");@If(sickdays="} & dat &{";"Z"; @if(approved1="V";@char(157);@If(VroegDatum="} & dat &{";"V";@If(MiddagDatum="} & dat &{";"D";@If(LaatDatum="} & dat &{";"L";@If(standby="} & dat &{";@Char(212);""))))))}

	Call view.Refresh

	count =count -1 																'Select the corresponding color column (next column) 

	

	Set vc = view.Columns(count-1)   					                   		'Sets the column to be re-designed

	

	vc.Title = "C" & Format$(dd,"dd")										'Rename the colums to C(olor)+daynum

	

	'Rewrite the color column formula that goes with the previous date-colum.

	Select Case Weekday(dd)												'Select background color by weekday

	Case 1,7 :  varColor = "242:242:242"		        					'Set to lightgrey on weekends

	Case	Else  : varColor = "255:255:255"								'use white on other days

	End Select

	vc.Formula={""}		

	vc.Formula = {red:=255:0:0;green:=0:222:0;yellow:=0:96:0;pink:=225:27:213;white:=242:242:242;plain:=0:0:0;tel:=@member("} & dat & {";@explode(absencedaystotal));approved:=@subset(approvetotal;tel);approved1:=@subset(approved;-1);@if(sickdays="} & dat & {";red;@If(absencedaystotal="} & dat & {";@if(approved1="V" | approved1="?" ;red;@if(approved1="X";yellow;@if(standby="} & dat & {";white:pink;green)));@if(standby="} & dat & {";white:pink;green)))}

	

	count =count -1																'Select the next column

	daycount = daycount -1													'and set the next day until offset is reached

Loop

End Sub

When i change the following line :

vc.Formula = {tel:=@member("} & dat &{";@explode(absencedaystotal));@if(tel<>0;approved:=@subset(approvetotal;tel);"");@if(tel<>0;approved1:=@subset(approved;-1);"");@If(sickdays="} & dat &{";"Z";@if(alphen="} & dat &{";"1";@if(approved1="V";@char(157);@If(VroegDatum="} & dat &{";"V";@If(MiddagDatum="} & dat &{";"D";@If(LaatDatum="} & dat &{";"L";@If(standby="} & dat &{";@Char(212);"")))))))}

The i get the error variant does not contain container.

The problem is that after a few loops the view.columns is empty.

In the first code the problem does not exist.

Does anyone what this can be?

Subject: variant does not contain container

I’m not sure why your view.Columns is becoming empty, but here’s a hint about formulas. Don’t write:

@If(a; x; @If(b; y; z))

It’s more efficient to write:

@If(a; x; b; y; z)

Subject: variant does not contain container

Roy,

If you turn on the LotusScript debugger, it will show you a list of all the variables and objects. You can then see which is causing you the problem.