马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622 。
您需要 登录 才可以下载或查看,没有帐号?注册
x
两个视图A(使用表单a),B(使用表单b)
如何通过“入库”操作使视图A中的某个被选择文档内容添加到视图B中?
比如视图A中某文档有设备1,型号1,数量1,根据设备1在视图B中找到设备1(其中在视图B中设备1已有多条记录即N种型号,各种型号数量不同),如何将这个文档内容添加到视图B中?
我的代码如下,想请大家修改一下:)
Sub Click(Source As Button)
Dim ws As New notesuiworkspace
Dim session As New notessession
Dim db As notesdatabase
Dim uiview As notesuiview
Dim view As notesview,view2 As notesview
Dim dc As notesdocumentcollection
Dim vc As notesviewentrycollection
Dim doc As notesdocument
Dim doc2 As notesdocument
Dim item As notesitem,item1 As NotesItem,item2 As NotesItem
Dim i As Integer,count As Integer
Dim strname As String
Dim strtype As String,strtype1 As String
Set db=session.currentdatabase
Set uiview=ws.currentview
Set dc=uiview.documents
count=dc.count
If count<1 Then
Messagebox "请您选择一个文档,再试!",48,"提示" '''''在当前视图中选择需入库文档
End If
Set view=db.getview("allequip")
Set vc = view.allentries
For i=1 To count
Set doc=dc.getnthdocument(i)
temp1=doc.b_count(0)
strtype1=doc.b_type(0)
If temp1="" Then
Messagebox "请选择要入库文档"
Exit Sub
End If
strname=doc.b_name(0)
If strname <> "" Then
search_string = "[goods_names]=" & Chr(34) & strname & Chr(34)
End If
temp2=view.ftsearch(search_string,0)
Call vc.ftsearch(search_string,0)
Call vc.RemoveAllFromFolder("query")
Call vc.PutAllInFolder("query")
Set view2=db.getview("query")
Set doc2=view.getlastdocument()
Set item = doc2.ReplaceItemValue("goods_counts",temp1)
Set item1 = doc2.AppendItemValue("goods_types",strtype1)
temp1=temp1+Cstr("(已分配)")
Set item2 = doc.ReplaceItemValue("b_count",temp1)
Call doc2.save(True,True)
Next
Call ws.viewrefresh
End Sub
    |