Lotus教程、Java教程、Java虚拟机、Java软件综合开发社区

Lotus、Domino、Java、C#、Web、数据库综合开发教程、资料社区

Lotus Notes常用代码



Published by admin on 08月 29, 2010

Lotus Notes常用代码
1.检测当前用户是不是文档的创建者,如果不是,不允许编辑文档。
Sub Querymodechange(Source As Notesuidocument, Continue As Variant)
Dim session As New NotesSession
Dim doc As notesdocument
Dim userName As New NotesName(session.UserName)
Set doc=source.document
If Not ( source.EditMode ) Then
If ( doc.authors(0) = username.CANONICAL ) Then
continue=True

Else
Msgbox “您不是此文档的创建人,不可以修改!”,0,”文档数据库”
continue=False
End If
End If
End Sub
2.退出时检测关键的域不能为空
Sub Click(Source As Button)
Dim w As New notesuiworkspace
Dim uidoc As notesuidocument
Dim doc As notesdocument
Set uidoc=w.currentdocument
name1=uidoc.fieldgettext(”name”)
If name1=”" Then
Messagebox “姓名不能为空!”,0,”通讯录”
Exit Sub
End If
Call uidoc.save
Call uidoc.close
End Sub
3.用私有视图来显示需要当前用户处理的文档,用以下视图公式:
注意建立视图时不要选中”保存到本地”选项,否则调试不便.
SELECT Form = “收文1″ & NextApprover=@Name([CN];@V3UserName)
4.Notes中Active控件
当文档中添加OLE或其他通用的ActiveX控件后,在文档的script编辑框右侧中,会自动添
加各种属性和方法在notes的类列表中.在script中声明该对象的 方法如下:
Sub Postopen(Source As Notesuidocument)
Dim w as notesuiworkspace
Dim uidoc as notesuidocument
Dim aa As Variant
Set w =New notesuiworkspace
Set uidoc =w.currentdocument
Set aa=uidoc. getObject(”Chart”)’该句为ole对象声明,注意Chart是你给对象起的名
字 ‘接下来你就可以通过aa.**来调用其方法和属性了.
End Sub
5.以下是script错误陷阱代码
Sub subname On Error Goto Errcode ‘下面添加你的程序代码
Exit Sub Errcode: Msgbox “错误 (” & Cstr(Err) & ” ) -> ” & Error$(Err),16,”错
误提示”
Exit Sub
End Sub
6.是否保存
在表单中设定一个域,名称为saveoptions
下列公式添加到返回按钮中,决定文件退出是否保存
FIELD saveoptions:=”1″; 保存 FIELD saveoptions:=”0″; 不保存
7.用公式弹出对话框,按确定继续,取消返回.
@If(@DialogBox(”表单名”;[AutoHorzFit]:[AutoVertFit];”表单标题”);”";@Return(”
“))
8.用script弹出对话框,按确定继续,取消返回
Dim w as notesuiworkspace
If Not w.dialogbox(”表单名”,True,True,False,True,False,False,”填写”)
Then doc.close’用户按取消退出
Exit Sub
End If

Pages: 1 2

上一篇文章:« DOMINO群集配置方法


【版权说明】:本网页上有部分内容来源于网上收集,但不能保证资料的完整性和准确性,仅提供参考和学习。如有侵权请立即通知我们,我们将立即删除,谢谢合作!

Add A Comment