Hello, I create the foillowing Document-Action and get a Problem.
This script copy some adress information from my databasedocuments to a notes-adressbook.
When I use the regular adressbook (Names.nsf) all work fine without any problem,
but when I use a new adressbook (secound adressbook), created from the pernames.ntf template, the script run without problems as long as the new adressbook opened the first time after the copy.
When I use the Actionbutton after the new adressdatabase was open notes goes to a ‘spinloop’
and the only way to stop this, kill the notes prozesses.
Add information, when I open the new adressbook after the copy. the About Document of this DB
will be displayed the first time.
I try the script in a Agent, too → same problem…
any hints are welcome.
Regards Lars
Dim sworkspace As New NotesUIWorkspace
Dim tworkspace As New NotesUIWorkspace
Dim suidoc As NotesUIDocument
Dim tuidoc As NotesUIDocument
Dim tdb As NotesDatabase
Dim session As New NotesSession
Dim kunde As String
Dim kundelang As String
Dim stra As String
Dim plz As String
Dim ort As String
Dim phone As String
Dim dirfn As String
Dim answer As Integer
Dim inputstring As String
Set suidoc = sworkspace.CurrentDocument
kunde = suidoc.FieldGetText( "Adres" )
kunde = Replace(kunde,"ß","ss")
kunde = Replace(kunde,"ä","ae")
kunde = Replace(kunde,"ü","ue")
kunde = Replace(kunde,"ö","oe")
kundelang = suidoc.FieldGetText( "Adres_1" )
kundelang = Replace(kundelang,"ß","ss")
kundelang = Replace(kundelang,"ä","ae")
kundelang = Replace(kundelang,"ü","ue")
kundelang = Replace(kundelang,"ö","oe")
stra = suidoc.FieldGetText( "Adres_2" )
stra = Replace(stra,"ß","ss")
stra = Replace(stra,"ä","ae")
stra = Replace(stra,"ü","ue")
stra = Replace(stra,"ö","oe")
plz = suidoc.FieldGetText( "Adres_3" )
ort = suidoc.FieldGetText( "Adres_4" )
ort = Replace(ort,"ß","ss")
ort = Replace(ort,"ä","a")
ort = Replace(ort,"ü","u")
ort = Replace(ort,"ö","o")
phone = suidoc.FieldGetText( "Adres_5" )
inputstring = "Please Enter the Filename of the used Adressbook w/o .NSF (e.g. FFATAdres)"_
& Chr$(13) & "If you use the Primary Notes Adresbook enter 'NAMES' w/o .NSF, "_
& Chr$(13) & "but it's recommended to use a separat adressbook. " & Chr$(13) & " "
dirfn = Inputbox(inputstring,"Get Adressdatabase")
If Ucase$(dirfn) = "NAMES" Then
answer% = Messagebox("... Adress BookTitle <- Is this the correct DB?", 4, "Database Name")
If answer <> 6 Then Goto ende
Set tuidoc = tworkspace.ComposeDocument( "", "names", "Person" )
Else
Dim dbchk As New NotesDatabase("","..\notes\data\"& dirfn)
If dbchk.Title= "" Then Goto notvalid
answer% = Messagebox(dbchk.Title & " <- Is this the correct DB?", 4, "Database Name")
If answer <> 6 Then Goto ende
Set tuidoc = tworkspace.ComposeDocument( "", "..\notes\data\"&dirfn, "Person",,False )
End If
tuidoc.ExpandAllSections
tuidoc.FieldSetText "LastName", kunde
tuidoc.FieldSetText "CompanyName", kundelang
tuidoc.FieldSetText "OfficeStreetAddress", stra
tuidoc.FieldSetText "OfficeZip", plz
tuidoc.FieldSetText "OfficeCity", ort
tuidoc.FieldSetText "OfficePhoneNumber",phone
tuidoc.Refresh
tuidoc.Save
tuidoc.Close(True)
Messagebox "Finished creating the document!"
Goto ende
notvalid:
Messagebox" you enter a not valid Database",16,"Information"
ende: