Can somebody please check what's wrong? I need to get the highest number in my Ticket no view. This view is sorted Desc, so the number on top of the view is always the highest one, after I get that number I need to grab it increment it and assign this number to the new document. I have this code in Querysave.
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim Num As String
Set db = session.CurrentDatabase
Set view = db.GetView("Ticket No.")
Set doc = view.GetFirstDocument
doc.seqnum = Num ' seqnum is the name of the 1st column in Ticket No.
If doc.fld_CDseqnum(0) <> 0 Then
' Increment the sequence number