Hi, I have plan to generate seqno with existing Database, as of now we are entering ENQNO by manually so it needs to be automated.
There are 2 problems
if i run my code from designer thru running form i am able to achive but if i run from workspace(opening db then running form) nothing is working
if i run the form from workspace
“If uidoc.isnewdoc then” from here it is not checking that whether doc is new or not, it is jumping to Endif with out checking code which is really starange.
Please advice me what would be problem
here is my code
Dim sess As New NotesSession
Dim ws As New NotesUIWorkspace
Dim db As NotesDatabase
Dim view As NotesView
Dim uidoc As NotesUIDocument
Dim lastdoc As NotesDocument
Dim doc As NotesDocument
Dim doc2 As NotesDocument
Dim num As Integer
Dim key As String
Set uidoc = ws.CurrentDocument
If uidoc.IsNewDoc Then
Set db = sess .CurrentDataBase
Set view = db.GetView(“OppSeqNo”)
key= “E” + Right(Cstr(Year(Today)),2)+“-”
Set lastdoc = view.GetDocumentByKey(key, False)
If lastdoc Is Nothing Then
num = 481
Else
num = Cint(Right(lastdoc.EqNo(0),3)) + 1
End If
Set doc = uidoc.Document
doc.EqNo=key + Right(Cstr(num),3)
Call uidoc.FieldSetText(“IENUserOppText02Value”,doc.EqNo(0))
End If
Note: i am able to run this code from designer client but not directly from workspace