I have a document, from that document I create a Notice document via a button. I use the profile to get the text for the notice, bellow is part of the code in the button. What I need to do is what the user enter the amount on the notice. I was trying to use a dialogbox before I call the function. I get the error (Dialogbox cannot be used in this context, a document must be selected) I am in a documetn when I click the button, also I use the “Set doc = uidoc.Document” to set the doc
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Set uidoc = workspace.CurrentDocument
Set db = session.CurrentDatabase
Dim NoticeDoc As notesdocument
Dim iReturn As Integer
Set doc = uidoc.Document
iReturn = workspace.DialogBox ( "dlgNoticeAmount", True, True, False, False, False, False, "Testing" , doc)
Set uidoc = workspace.CurrentDocument
Call CreatThe Notice(uidoc, NoticeNo)
any ides…
thanks
paul
Subject: trying to use a dialogbox,
Yes you may need Set workspace=New NotesUIWorkspace somewhere
A better approach is to create an “in memory” document to hold your dialog box fields and use that to process the data and then set it to nothing when you are done.
e.g. Dim docDialog as NotesDocument
Set docDialog=db.createDocument
Call docDialog.replaceItemValue(“field1”,“”)
Call docDialog.replaceItemValue(“field2”,“”)
etc.
iReturn=workspace.DialogBox(“dlgNoticeAmount”, True, True, False, False, False, False, “Testing” , docDialog)
Subject: RE: trying to use a dialogbox,
thanks for your help, it worked…but now… every time I get ahead, I get an error,
I am getting an error telling me that the function has the wrong number of arguments,
if I call the function this way Call CreateNotices(uidoc, NoticeNo) I have the same function in the script library.
Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
Dim docDialog As NotesDocument
Set docDialog = session.currentdatabase.createdocument
Dim NoticeDate As String, noticeAmountMontant As String
Call docDialog.replaceItemValue("NoticeDate","")
Call docDialog.replaceItemValue("NoticeMontant","")
If workspace.dialogbox("dlgNoticeAmountt",True,True,False,True,False,False,"Title",docDialog) Then
NoticeDate = Cstr(docDialog.NoticeDate)
NoticeAmount= Cstr(docDialog.NoticeAmount)
Else
End If
AvisNo = 1
Call CreateNotices(uidoc, NoticeNo, NoticeDate, NoticeAmount ) ' I am getting the wrong number of argument error here, all I want to do is to pass the NoticeDate and NoticeAmount to the function.. any clues on what I am doing wrong?
thanks again… paul
Subject: RE: trying to use a dialogbox,
does the function in the script library also has 4 arguments defined…??For e.g.
Sub CreateNotices(uidoc as Notesuidocument, NoticeNo as String, NoticeDate as String, NoticeAmount as String)
’ your code here
End Sub
Subject: RE: trying to use a dialogbox,
thanks for your help. yes it does… I shut down twice and and uncommented the funcion and now it saved ok… must be cache… i guess
Subject: trying to use a dialogbox,
The issues that I see are