View member feedback to this tip.
I'm using this code in the document QuerySave event. I have a document(numdoc) with only one field, which contains the last number.
If Source.Document.Number(0)="" Then
Set ss=New NotesSession
Set db=ss.CurrentDatabase
Set doc=Source.Document
Set view=db.GetView("Number")
Set numdoc=view.GetFirstDocument
Do
k=k+1
new&=numdoc.Number(0)+1
doc.Number=new&
numdoc.Number=new&
If k>100 Then
Messagebox"Sorry,
I cannot save the document, please try it again"
Continue=False
Exit Sub
End If
Loop Until numdoc.Save(False, False)
End If
MEMBER FEEDBACK TO THIS TIP
When you have serveral replicas of your database, your script doesn't worked correctly.
Axel
Do you have comments on this tip? Let us know.