Manage Learn to apply best practices and optimize your operations.

Notes2Access With Dao


Sub Click(Source As Button)
'On Error Resume Next
Dim dbE As Variant
Dim ws As Variant
Dim Accessdb As Variant
Dim rs As Variant
Dim fl As Variant

Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim item As NotesItem

Set db = session.CurrentDatabase
Set view = db.GetView("($Import)")
' You may have to substitute "DAO.DBEngine.35" with "DAO.DBEngine" depending on
your version of DAO
Set dbE = CreateObject( "DAO.DBEngine.35" )
Set ws = dbE.CreateWorkspace( "", "admin", "", 2 )

' Open database - replace MW.MDB with your database name
Set Accessdb = ws.OpenDatabase( "D:\MW.MDB" )

' Open recordset - replace Verbindungsdaten with your table name
Set rs = Accessdb.OpenRecordset("Verbindungsdaten")

Set doc = view.GetFirstDocument

While Not (doc Is Nothing)

' Add a new recordset

rs.AddNew

'Syntax : rs.Fields("FieldInAccessTable").Value = "FieldInNotesDoc"
rs.Fields( "Name" ).Value = ItemTextReturn(doc,"User")
rs.Fields( "Gruppe" ).Value = ItemTextReturn(doc,"Gruppe")
rs.Fields( "DatumBeginn" ).Value =
ItemTextReturn(doc,"VerbindungBeginn")
rs.Fields( "DatumEnde" ).Value = ItemTextReturn(doc,"VerbindungEnde")
rs.Fields( "ZeitBeginn" ).Value =
ItemTextReturn(doc,"VerbindungBeginnZeit")
rs.Fields( "ZeitEnde" ).Value =
ItemTextReturn(doc,"VerbindungEndeZeit")
rs.Fields( "Dauer" ).Value =
ItemTextReturn(doc,"VerbindungDauerSekunden")
rs.Fields( "KST" ).Value = ItemTextReturn(doc,"KST")

rs.update

Set doc = view.GetNextDocument(doc)

Wend

Call rs.Close
Call Accessdb.Close
Call ws.Close

End Sub

Function ItemTextReturn(doc As NotesDocument, itemName As String) As String

' Check whether the specified document has the specified item
' and whether there is an actual value... Returns "" if the
' item does not exist, or if it does exist and it's text value is
' null (""). Returns the value if it does exist. Accessing the
' text property of an item is a quick and dirty way to get an
' item's value as a string.

On Error Goto ErrorHandler

ItemTextReturn = ""
Dim tempString As String

If (doc Is Nothing Or Strcomp(itemName, "") = 0) Then Goto TheEnd

If doc.HasItem(itemName) Then
ItemTextReturn = Trim$(doc.GetFirstItem(itemName).Text)
End If

TheEnd:
Exit Function

ErrorHandler:
ItemTextReturn = ""
Resume TheEnd

End Function

Dig Deeper on Domino Resources - Part 7

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close