|
|
Question : Lotus Notes Question
|
|
I have the following code that populates a list box with the views in a lotus notes database:
Dim session As Object Dim db As Object Dim doc As Object Dim View As Variant Dim field As Variant Dim DbName As String Dim server As String DbName = "Databases/FROPS.NSF" server = "NotesSRVHQ2/Midas_International"
Set session = CreateObject("Notes.NotesSession") 'Open the database Set db = session.GETDATABASE(server, DbName) If db.IsOpen = True Then For Each View In db.VIEWS List1.AddItem View.Name Next View Else MsgBox "Database Not open" End If
Set db = Nothing Set session = Nothing
End Sub
my question is...
if i select a view from the list box I would like to display the view data but I'm not sure how to go about creating a recordset to get the data from the lotus notes view.
Can someone please help?
|
Answer : Lotus Notes Question
|
|
ok, bear in mind I know jack about Lotus notes having not used or seen it before, and cos of that I cannot even verify my own code here Im hoping something along these lines would do it for u
Public Sub MyFirstAttemptAtUsingLotusNotesSoBearWithMe()
Dim adoConn As New ADODB.Connection Dim adoRS As ADODB.Recordset On Error Resume Next adoConn.Open "Driver={Lotus NotesSQL 3.01 (32-bit) ODBC DRIVER (*.nsf)};" & _ "Server=myServerName;" & _ "Database=mydir\myDbName.nsf;" & _ "Uid=myUsername;" & _ "Pwd=myPassword" If Err.Number <> 0 Then MsgBox "Bugger, I cant connect." & vbCrLf & Err.Description Set adoConn = Nothing End If
Set adoRS = New ADODB.Recordset adoRS.ActiveConnection = adoConn adoRS.CursorType = adOpenKeyset adoRS.LockType = adLockPessimistic adoRS.CursorLocation = adUseClient adoRS.Open "SELECT * FROM MyLotusNotesTable" Do While adoRS.EOF = False Debug.Print adoRS.Fields(0).name, adoRS.Fields(0).Value adoRS.MoveNext Loop adoRS.Close adoConn.Close Set adoRS = Nothing Set adoConn = Nothing end sub
|
|
|
|
|