views:

299

answers:

2

I'm trying to connect to a Lotus Notes database via VBA in Microsoft Access 2003. The code I have is as follows:

Set nSession = CreateObject("Notes.NotesSession")

Set nDatabase = nSession.GetDatabase("CN=MT_N01/O=Org Name", "LossPrevention\BrchPrVI.nsf", False)

I've tried variations for the server name, but nothing seems to work. In Lotus Notes it appears as "Server: MT_N01/Org Name". I've tried just "MT_N01" and "MT_N01/Org Name", but the NotesDatabase variable keeps ending up empty.

Any tips?

A: 

I might be wrong here, but I think you should call the Initialize() method of the session prior to using it.

Take a look at the samples here: http://www.ibm.com/developerworks/lotus/library/domino-msnet/index.html

SaguiItay
A: 

I think that behaviour is normal; VBA knows nDatabase is a variant/object, but does not know anything about its contents. At least that is what I get when I try your code in Excel 2003.

Try to return something from the database object, for example nDatabase.ReplicaID should return the database identity string. If the databas is not properly loaded, you will get an error.

Many good links are posted in response to the ".NET and Lotus Notes Interop." question.

Anders Lindahl