Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing a Lotus Notes db with VBA

Status
Not open for further replies.

batteam

Programmer
Sep 12, 2003
374
US
I have the follwing code but cannot get to compile:

serv = "njros1nap2020"
app = "webchat\iLi\cvcchatlog.nsf"
Dim db As NotesDatabase
Set db = Session.CURRENTDATABASE
Set db = New NotesDatabase(serv,app) I get' Expected: end of statement error' at the '('character before 'serv'.


I also have the code to search Lotus Notes db as:
searchFormula$ = "'((Form = "ITAgentLogEntry") & ITLog_ConversationText != "Sample Logging" ) "

I cannot get the variable searchFormula$ to return any data. It just returns the string itself.

Any assistance that can be provided would be greatly appreciated.
 
hi,

Is this Access?

forum705

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
SkipVought:

Can you provide any assistance? Would appreciate anything you can provide.
 
After much trial and error and a little help from a Lotus db programmer, below is the answer to my question. Note that '@Created' is a field in the Lotus Notes db. This format is useful when the LotusDBSQL OBDC driver is not an option.

varA = "Form = ""ITAgentLogEntry"" & @Created > [" & strInput1 & "] & @Created < [" & strInput2 & "]"


Also, the following Dim's were used:

Dim s As NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim doccol As NotesDocumentCollection

Dim nsession As NotesSession
Set nsession = CreateObject("Lotus.NotesSession")
Call nsession.Initialize
Set db = nsession.GetDatabase(serv, app) --(server path and name, and file name (.nsf))

Very Important Note: Notice I set 'nsession' to "Lotus.NotesSession', NOT 'Notes.NotesSession'.

I truly hope this syntax helps VBA programmers out there in the future. I spent days on this.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top