Hi,
I’m trying to add sequential numbering to my application. I already have a script which works fine in the QuerySave event.
I need to get the counter to reset to 0 at the beginning of each year.
This is the script that I’m using now:
Dim s As NotesSession
Dim w As NotesUIWorkspace
Dim d As NotesDatabase
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim doc2 As NotesDocument
Dim v As NotesView
'declaring other variables
Dim keepreqno As Integer
Dim reqno As Variant
Dim keepyear As Variant
'initializing the variables
Set s = New NotesSession
Set w = New NotesUIWorkspace
Set d = s.CurrentDatabase
Set uidoc = w.CurrentDocument
Set v = d.GetView("Sequence Numbers")
Set doc = v.GetFirstDocument
Set doc2 = uidoc.Document
If Not(doc Is Nothing) Then
If uidoc.IsNewDoc Then
keepreqno = doc.SNNumber(0)
keepreqno = keepreqno + 1
doc.SNNumber = keepreqno
doc2.storereqno = doc.SNNumber(0)
Call doc.Save(True,True)
keepyear = doc2.storeyear(0)
keepreqno = doc2.storereqno(0)
doc2.rfstorereqnum = Str$(keepyear) + "/" + Str$(keepreqno)
Call doc2.Save(True,True)
End If
End If
Much Thanks!