如何判断一个域是否属于子表单?

Wangckyo 2007-12-03 10:33:33
在表单中嵌入了多个子表单,有什么办法可以判断其中的域是属于主表单还是子表单?
...全文
51 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
gracian 2007-12-03
  • 打赏
  • 举报
回复
原则上都属于主表单
fare2000 2007-12-03
  • 打赏
  • 举报
回复
你是开发者当然自己知道是那个子表单里的啊,如果需要程序自动区分可以在设计时字段名用特定的前缀如:s1_name1,s1_name2,...,然后在你的代码里判断这个前缀就知道是那个子表单了。如果真的要较真只好遍历

子表单对象逐一判断它的Field name 如果找到了自然是子表单字段了。

对象层次:
form=DB.Forms(i)
if form.IsSubform and form.Name="MySubForm" then
item=form.Fields(i)
....
end if

具体的可查帮助:
This script displays the names of all the fields on a form.
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
formNameIn = Lcase(Inputbox("Name of form?"))
Forall form In db.Forms
If Lcase(form.Name) = formNameIn Then
If Isempty(form.Fields) Then
Messagebox form.Name & " has no fields"
Else
fieldCount = 0
msgString = ""
Forall field In form.Fields
fieldCount = fieldCount + 1
msgString = msgString & Chr(10) & _
" " & field
End Forall
Messagebox form.Name & " has " & _
fieldCount & _
" field(s):" & Chr(10) & msgString
End If
Exit Sub
End If
End Forall
Messagebox "The form """ & formNameIn & """ does not exist"

535

社区成员

发帖
与我相关
我的任务
社区描述
企业开发 Exchange Server
社区管理员
  • 消息协作社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧