PowerUser
PowerUser

Reputation: 11791

How to search Lotus documents using VBA

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

Upvotes: 2

Views: 1504

Answers (1)

Ken Pespisa
Ken Pespisa

Reputation: 22266

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/

Upvotes: 1

Related Questions