如何使用 VBA 搜索 Lotus 文档
我需要从 Lotus 表单中获取 3 个特定字段并放入静态 Access 表中,我可以从中执行更多查询(其中 2 个字段作为主键,以便我可以将第三个字段与其他内容连接起来)。在下面的伪代码中,我充实了一个函数来做到这一点,但我无法弄清楚细节(我认为如果没有正式培训,我永远不会理解 Lotus 的工作原理)。请帮我完成这个程序?
Function GetFromLotusDocs() As String
Dim NtS As New NotesSession
Dim NtDb As New NotesDatabase
Dim NtF As New NotesForm
NtS.Initialize
Set NtDb = NtS.GetDatabase("MyServer", "MyDB.nsf")
Set NtF = NtDb.GetForm("MyForm")
For each document in NtDB
DoCmd.RunSQL _
"INSERT INTO TmpTbl ( Fld1,Fld2,Fld3 ) SELECT " & _
Fld1 & "," & Fld2 & "," & Fld3 & ";"
Next document
End Function
I need to get 3 specific fields out of a Lotus form and into a static Access table from which I can do more queries (2 of those fields make a primary key so i can join the 3rd with other stuff). In the pseudo-code below, I've fleshed out a function to do just that, but I can't figure out the details (I don't think I'll ever understand how Lotus works without formal training). Please help me finish this procedure?
Function GetFromLotusDocs() As String
Dim NtS As New NotesSession
Dim NtDb As New NotesDatabase
Dim NtF As New NotesForm
NtS.Initialize
Set NtDb = NtS.GetDatabase("MyServer", "MyDB.nsf")
Set NtF = NtDb.GetForm("MyForm")
For each document in NtDB
DoCmd.RunSQL _
"INSERT INTO TmpTbl ( Fld1,Fld2,Fld3 ) SELECT " & _
Fld1 & "," & Fld2 & "," & Fld3 & ";"
Next document
End Function
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您只需要从 Notes 获取数据并导入 Access,我建议安装和配置 Lotus Notes SQL 驱动程序。我曾多次使用它来将数据提取到 Access 中,通常是为了让我在将数据移至 SQL 或 SQL Express 数据库之前对其进行清理。
链接如下: http://www.ibm.com/developerworks/lotus/产品/notesdomino/notessql/
If you just need to get data out of Notes and into Access, I suggest installing and configuring the Lotus Notes SQL driver. I've used it many times to pull data into Access, usually to allow me to clean it up before moving it to a SQL or SQL express database.
Here's the link: http://www.ibm.com/developerworks/lotus/products/notesdomino/notessql/