请教下面这段代码

monqu 2005-08-22 08:14:27
小弟半路被拖着维护LOTUS,无奈语法什么的都不懂,特请教以下这段代码
Sub Exiting(Source As Field)
Dim workspace As New notesuiworkspace
Dim doc As notesuidocument
Set doc =workspace.currentdocument
Dim note As notesdocument
Set note=doc.document
Dim keys As String
keys = note.bookname(0)//这句是什么意思,那个属性代表什么意思,我在哪里可以查到这个属性?

Dim s As New notesSession
Dim db As notesdatabase
Set db=s.currentdatabase
Dim view As notesview
Set view=db.getview("bybookno")
Set tmpnote = view.getdocumentbykey(keys,True) //这句是什么意思?
If Not(tmpnote Is Nothing) Then
note.bookno = tmpnote.bookno(0)
note.endnum = tmpnote.endnum(0)
m_end=doc.fieldgettext("endnum")
If m_end<=0 Then
Msgbox "此图书库存为0,不可外借"
Call doc.gotofield("bookname")
Exit Sub
End If
Else
Msgbox "提示:你必须选择待借图书名称!"
Call doc.GotoField("bookname")
Exit Sub
End If
End Sub

代码执行有错误.一离开就bookname这个域就显示你必须选择待借图书名称,也就是执行了else.请问为什么,我明明都有选择了书本.还有上面有两个标志疑问,也请帮忙回答一下,其他的大概都看的懂,谢谢!
...全文
99 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
hanwenjuan3 2005-08-24
  • 打赏
  • 举报
回复
keys = note.bookname(0)//意思是把文档note中域bookname的数值给变量keys

Set tmpnote = view.getdocumentbykey(keys,True) 把视图中满足文档中域bookname的数值等于变量keys的文档付值给tmpnote
zalvsa 2005-08-23
  • 打赏
  • 举报
回复
试一下这个
Sub Exiting(Source As Field)
Dim workspace As New notesuiworkspace
Dim doc As notesuidocument
Set doc =workspace.currentdocument
Dim note As notesdocument
Set note=doc.document
Dim key(0 To 1) As String
key(0) = note.bookname(0)
Dim s As New notesSession
Dim db As notesdatabase
Set db=s.currentdatabase
Dim view As notesview
Set view=db.getview("bybookno")
Dim tmpnote As NotesDocument
Set tmpnote = view.GetDocumentByKey(key,False)

If Not(tmpnote Is Nothing) Then

note.bookno = tmpnote.bookno(0)
note.endnum = tmpnote.endnum(0)
m_end=doc.fieldgettext("endnum")
Msgbox m_end
If m_end<=0 Then
Msgbox "此图书库存为0,不可外借"
Call doc.gotofield("bookname")
Exit Sub
End If
Else
Msgbox "提示:你必须选择待借图书名称!"
Call doc.GotoField("bookname")
Exit Sub
End If
End Sub
monqu 2005-08-23
  • 打赏
  • 举报
回复
这里实在有够冷清!另找其他地方请教去!
monqu 2005-08-22
  • 打赏
  • 举报
回复
还有我如何输出tmpnote这个变量(测试用)?谢谢

535

社区成员

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

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