GetItemValue return no value

I am using the following code to return a value from a field on a profiledocument: The fieldname is newyearaccount’profdoc is set as NotesDocument.

'in LS debugger I can see the item and his value of the field newyearaccount (value is “2006”)

. . . .

Dim yearstring as String

Dim year as Integer

yearstring=profdoc.GetItemValue(newyearaccount)(0) → returns no value

yearstring=profdoc.newyearaccount(0) → returns the year (“2006”)

year = CInt(yearstring)

What is happening here?

Subject: GetItemValue return no value

The problem is, GetItemValue takes a string, and you are passing a variable, so you are effectively saying

yearstring=profdoc.GetItemValue(“2006”)(0)

when you want

yearstring=profdoc.GetItemValue(“newyearaccount”)(0)

Just remember the quotes.

Subject: GetItemValue return no value

Sorry, problem solved.

Line should be: yearstring=profdoc.GetItemValue(“newyearaccount”)(0)