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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I open Lotus Notes from Access and pass a password as well?

Status
Not open for further replies.

ISUTri

MIS
Mar 25, 2004
38
US
I am currently using the following code to open up lotus notes and send an email out.

However, the code that actually opens Lotus Notes prompts me for a password everytime. I was wondering how can I pass a password through so I can automate this?

This code (Maildb.OPENMAIL) opens notes and always prompts for a password.
-----------------------------------------------------------
Dim WasOpen As Integer 'Checking to see if the Mail DB was alread
Set Session = CreateObject("Notes.NotesSession")
domSession.Initialize (rstPsswd!PassWd)
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
Set Maildb = Session.GetDatabase("", MailDbName)
If Maildb.IsOpen = True Then
WasOpen = 1 'Already open for mail
Else
WasOpen = 0
Maildb.OPENMAIL 'This will prompt you for password
End If
Set MailDoc = Maildb.CreateDocument
 
Did you find the solution?
I'm using LN 4.6, and I think it does not support session.Initialize()
Other ideas?
Something like this?
Code:
WindowName = "Enter Password"
' Define AND Get the handle of the window you're looking for, at the same time.
hWnd_Of_FindWindow = FindWindow(ClassName, VarPtr(WindowName))
hWnd_Of_FindWindow = 1312738
' Process the results of FindWindow
If hWnd_Of_FindWindow > 0 Then
        Call SetForegroundWindow(hWnd_Of_FindWindow)
        Call keybd_event(VK_RETURN, ENTER, 0, 0) ' ‘ENTER’ Press
        Call keybd_event(VK_RETURN, ENTER, WM_KEYUP, 0) ' ‘ENTER’ Release
        Call SendMessageAPI(hWnd_Of_FindWindow, WM_KEYDOWN, 0, 0)
Else
 ' End If
This works in a visual basic standalone app, but it does not inside Microsoft Access, although I also added these declarations:

Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (lpClassName As String, lpWindowName As Long) As Integer
Private Declare Function SendMessageAPI Lib "user32" Alias "SendMessageA" (hWnd As Long, wMsg As Long, wParam As Long, lParam As Long) As Long
Private Declare Sub keybd_event Lib "user32" (bVirtualKey As Byte, bScanCode As Byte, dwFlags As Long, dwExtraInfo As Long)
Private Declare Sub SetForegroundWindow Lib "user32" (hWnd As Long)

-- Jumpjack --
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top