Smart questions
Smart answers
Smart people
Join Tek-Tips Forums
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Open non-email Lotus Notes Database using VBA

pscribby (Programmer) (OP)
26 Aug 09 12:54
I posted the following on another thread on this site last week, and am following a suggestion to try this forum instead... see below:

pscribby (Programmer)      
20 Aug 09 13:22
I am trying to write a VBA module for use inside an MS Access database.  Inside the Access dB, I have a claim number.  I need to set up a button on my form in Access which, when clicked opens the Claims Database, which is a Lotus Notes Database.  I do not need to transfer any data in either direction, I just want to open the Notes database in the client of Lotus Notes, and show the form view for the record (document in Notes terminology) that matches my claim number.  I do not know Notes at all.  I have managed to enable the Notes objects/classes in Visual Basic, but don't know how to correctly use them.  I have the server path, database file name, name of the form inside the Notes dB, and the name of the field on the Notes form (which I need to match to my variable)...
So far, I can only successfully open the Notes database using a shell command.  I have a test code module where I have been able to successfully (I think) declare the needed variables, set session, set db, but db.open gives me a "type mismatch" error.  Below is the code so far (which isn't working...  and I have not added the details to specify the field and search variable yet):

Private Sub test2()

Dim db As Object
Dim dbname As String
Dim dbpath As String
Dim session As Object
Dim view As Object

Set session = CreateObject("Notes.NotesSession")

dbname = "<mydatabase.nsf>"
dbpath = "<myserverpath/>"
Set db = session.GetDatabase(dbpath, dbname)

Set view = db.GetView("<myformname>")

db.Open


End Sub
 

HughLerwill (Programmer)     
21 Aug 09 14:52
I cannot be of much help because I do not have Notes to play with (and do not know much about it) but I think a Google for;

createobject("notes.notesuiworkspace")

may be of help. Most examples are for email from vb code (my main interest) but it seems notesuiworkspace needs to be used to get Notes to display stuff on-screen.

A Google for 'Domino' may give you an object model.

forum9: Lotus/IBM: Domino: Lotus/IBM: Domino may be worth a try.

Thank HughLerwill
for this valuable post!

    

pscribby (Programmer)     
26 Aug 09 12:49
Thanks HughLerwill!

I have 2 different paths I experimenting with.  One of them includes the notes.notesuiworkspace method that you mentioned.  Below is the code so far:

Private Sub test2()

Dim db As Object
Dim dbname As String
Dim dbpath As String
Dim dbfull As String
Dim session As Object
Dim view As Object
Dim doc As Object
Dim docname As String

docname = "<a known good doc number>"

Set session = CreateObject("Notes.NotesSession")

Set uiworkspace = CreateObject("Notes.Notesuiworkspace")

dbname = "<mydbname>"
dbpath = "<mypathname>"
Set db = session.GetDatabase(dbpath, dbname)

Set view = db.GetView("fm_ClaimCase")

End Sub

This code does not throw any errors on debug, and when I run it, no errors appear - but nothing seems to happen either (ie: the notes ui session does not open).  I have another approach in which I can successfully open the notes ui workspace using a shell command, but where I get stuck there is that I can't figure out how to specify the view/form and the document I want opened on said view/form...  I've Google'd this dozens and dozens of times every which way I can think of... all I keep getting are ways to generate emails from/inside of Notes... nowhere am I finding anything on opening a non-email Notes database...  I will also look in the other forum you mentioned to see if somebody there maybe has an idea...
All ideas are appreciated!  Thanks!  
pscribby (Programmer) (OP)
27 Aug 09 10:27
Solution Found!

With the help of a response on another thread, and some additional research, I found the solution.  The working code is posted below for anyone who may be looking for a similar solution...

Thanks

Public Function openLegalClaim(legalclaim As String)


Dim dbname As String
Dim dbpath As String
Dim docname As String
Dim notesuiworkspace As Object

docname = legalclaim

Set notesuiworkspace = CreateObject("Notes.Notesuiworkspace")

dbname = "<dbname>"
dbpath = "<dbserverpath>"

Call notesuiworkspace.OpenDatabase(dbpath, dbname, "<viewname>", docname, False, False)



End Function

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close