Access Notes Object from VB

I want to send a notes mail, under control of VB.  I have connected to the notes object and tried the following code:

Dim session As Object
Dim db As Object
Dim doc As Object
Dim s As String

Set session = CreateObject("Notes.NotesSession")

Set db = session.CURRENTDATABASE
doc.Form = "Memo"
doc.SendTo = "Raymond J Michels/BALT/BDX"
doc.Subject = "Here's the document you wanted"
Call doc.SEND(False)

Session is valid, because I can access a value like NotesVersion.  But the session.CurrentDatabase is returning Nothing, not setting the db variable.

At one point this started working, but it mostly fails:

1) Why?
2) Is there any web based document on accessing the notes object (better than what comes in notes help).

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

There is a VB demo that comes with LSX toolkit at

In the example, it uses:
Call db.openmail       'set database to default mail database

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rmichelsAuthor Commented:
I'm not sure this answers my question (without looking at the lSX toolkit).

In my example, the db object is Nothing, so I can't access it to do the OpenMail method.

That function db.openmail sets the db to the default mail database(I think it gets it from NOTES.INI), so it does not matter if db is set to NOTHING.
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

rmichelsAuthor Commented:
Trying to do this in VB, db must be something, not nothing.  VB will display an error if you try to use the a method on an object that is nothing.
I should have posted more of the routine from the example:
Private Sub Form_Load()
's and db declared in general as object
Set s = CreateObject("Notes.Notessession")  'create notes session
Set db = s.getdatabase("", "")       'set db to database not yet named
Call db.openmail       'set database to default mail database

I hope this makes it more clear for you how to set db.
rmichelsAuthor Commented:
Thanks.  It works now :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.