Hi pals, I need some help in creating new docs
In a open doc, i have a button to create new docs
the code just like the one below :
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Dim i As Integer
For i = 1 To 10
Dim splitDoc As NotesDocument
Set splitDoc = db.CreateDocument
splitDoc.form = “SPB”
If doc.Save(False,False) = True Then
Msgbox(“Succesfully create doc”)
End If
Next
I want to create 10 docs, when the code is executed, msgbox “Succesfully create doc” appear as many as 10, means that all 10 doc succesfully created.
The prob is that when i check on a view based on Form SPB, it contains nothing…
anyone knows why??
thx before
Subject: Need help on create doc
Hi Jil,
Do your database contains any default views?
If not, create the one or make any of the existing one as default. I faced similar problem many times.
Let me know the results.
LOL
Subject: RE: Need help on create doc
Yes it has default view…
BTW thx for your help.
I had known the prob.
the prob is just me that type the codes incorrectly…
i declared splitDoc as notesdocument, but when saving the doc, with call doc.save…that must be call splitDoc.save…
OMG…
Subject: RE: Need help on create doc
maybe your problem is not the view.
have a look in the db property dialogbox, how many documents exist before you press the button.
after then look the db properties again.
if the number of documents are the same, then you haven´t a view prob.
if my assumption is correct, then paste the code to an Agent,
and call him from the button.
I guess then the problem is, that you try to create Docs from the frontend, regarding the backendclass “Notessession”.
for the agent it´s correctly but not for the button
Bernhard
Subject: Need help on create doc
Hi,
you try to save “doc” and not “splitDoc”.
and the msgbox is not correctly placed.
try this code:
Dim db As NotesDatabase
Dim splitDoc As NotesDocument
Dim i As Integer
Set db = session.CurrentDatabase
For i = 1 To 10
Set splitDoc = db.CreateDocument
splitDoc.form = “SPB”
Call splitDoc.Save(True,False,False)
next
msgbox i & " docs are created"
Subject: RE: Need help on create doc
Thx all for your reply…problem solved…
I incorrectly wrote doc instead of splitDoc