Integer field value exceeded 32767 what do I do?

Hello all:I have a field of type number it is now holding 32767

in a function I increment this field+1 each time this function is called

I declared my function as follws

Function Serial(db As NotesDatabase) As Integer

so each time I try to add +1 to that field type ,I get an overflow error

what do I do ,I tried declaring the function as double but I get a type mismatch error from the very beginning

thanks

Dalia

Subject: Try the data type Long

Try the data type Long instead of Integer.

Henrik

Subject: RE: Try the data type Long

I tried but I got the same resulttype mismatch on external name serial

Subject: Use the debugger (WAS: integer field value exceeded 32767 what do I do?)

There’s something wrong with your function in that case. A number field can store values greater than 32767 (the limit for integers in Notes), so your code needs redress.

I created some test code to increment a double which works just fine. If you’re getting a “Type Mismatch” you’re probably not setting the “starting point” for your code properly (i.e. the value you’re grabbing from the document isn’t registering in script as a Double):

Dim dbl As Double

Dim dblNew As Double

' // Instantiate doc NotesDocument

dbl = doc.YOUR_NUMBER_FIELD(0)

dblNew = dbl + 1