Domino 9 und frühere Versionen > Entwicklung
Globales NotesDocument Objekt???
Glombi:
Poste mal den Code für QueryOpen und PostOpen. Es sieht ja alles ok aus.
gapee:
OK. Also dann:
Globals (NotesForm):
Public WFDbProfile As NotesDocument
Public SetupDbProfile As NotesDocument
QueryOpen-Event:
Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)
Const cSetupProfileView = "DBPROFILEHIDDEN"
Dim Session As New NotesSession
Dim SetupDb As NotesDatabase
Dim SetupProfileView As NotesView
Dim cSetupServer As String
Dim cSetupFilename As String
Dim cMessage As String
' grab workflow-database profile document
Set WFDbProfile = GetDBProfileDocument Hieran nicht stören.Alles bestens
If( Source.IsNewDoc ) Then
If( Not WFDbProfile Is Nothing ) Then
cSetupServer = WFDbProfile.SetupDbServer(0)
cSetupFilename = WFDbProfile.SetupDbFilename(0)
Set SetupDb = Session.GetDatabase( cSetupServer, cSetupFilename, False )
If( Not SetupDb Is Nothing ) Then
Set SetupProfileView = SetupDb.GetView( cSetupProfileView )
Set SetupDbProfile = SetupProfileView.GetFirstDocument ' hier ist es da
If( Not SetupDbProfile Is Nothing ) Then
continue = True
Else
cMessage = |Das Profil-Dokument für die Invoice-Master Setup-Datenbank ist nicht vorhanden.
Bitte verständigen Sie den System-Administrator|
Messagebox cMessage, 64, "Datenbank-Fehler"
continue = False
End If
Else
cMessage = |Die Invoice-Master Setup-Datenbank konnte nicht erreicht werden.
Bitte kontaktieren Sie den System-Administrator|
Messagebox cMessage, 64, "Datenbank-Fehler"
continue = False
End If
Else
' don't allow to create a new user profile (let admin create a db profile first)
cMessage = |Wegen eines fehlenden Datenbank-Profil-Dokumentes können Sie
leider zur Zeit kein Benutzer-Profil anlegen.
Bitte kontaktieren Sie den System-Administrator|
Messagebox cMessage, 48, "Datenbank-Setup-Fehler"
Continue = False
End If
End If
End Sub
Und schliesslich das
PostOpen-Event:
Sub Postopen(Source As Notesuidocument)
stop
If( Not SetupDbProfile Is Nothing ) Then ' und hier nicht mehr
With Source.Document
' grab some settings from setup database's profile document
.System = SetupDbProfile .System(0)
.SystemGUID = SetupDbProfile .SystemGUID(0)
.SeratioAdress = SetupDbProfile .SeratioAdress(0)
.SeratioPort = SetupDbProfile .SeratioPort(0)
.ArchiveAdress = SetupDbProfile .ArchiveAdress(0)
.ArchivePort = SetupDbProfile .ArchivePort(0)
Call .Save(True, True)
End With
End If
End Sub
Hoffentlich hilft's
Semeaphoros:
Mag sein, dass er das Public im Global nicht so gerne hat, weiss ich aber nicht wirklich.
Andere frage: hast Du in Deinem Code jeweils Option Declare (oder Option Explicit) gesetzt? Vielleicht gibt das ja an, was ihm Bauchweh macht.
Glombi:
Sieht alles gut aus, bis auf
1)
If( Source.IsNewDoc ) Then...
D.h. das SetupDbProfile wird nur bei neuen Dokumenten gesetzt.
2) Es handelt sich nicht wirklich um ein Profildokument, oder? Denn dann kann man es nicht so
Set SetupDbProfile = SetupProfileView.GetFirstDocument
setzen.
Kannst Du mal zweckes Tests folgendes machen:
If( Not SetupDbProfile Is Nothing ) Then
msgbox SetupDbProfile.System(0)
continue = True
Dann müsste ja was ausgegeben werden.
Andreas
gapee:
Zu 1) Es soll auch nur dann etwas gesetzt werden, wenn Source.IsNewDoc = true. Das ist in Ordnung so
Zu 2) Ich verwende nicht so gerne 'echte' Profil-Dokumente.
Klar, die Anweisung Set SetupDbProfile = SetupProfileView.GetFirstDocument verwirrt in diesem Zusammenhang etwas, aber auch das ist in Ordnung.
Und der Codevorschlag von Dir produziert mir innerhalb des 'QueryOpen'-Events produziert die richtige Ausgabe.
Ich kann mir das einfach nicht erklären, warum im 'PostOpen'-Event einfach nichts mehr da ist.
Könnte es möglicherweise sein, dass die Dok-Referenz verschwindet, weil es aus einer anderen Datenbank kommt?
Navigation
[0] Themen-Index
[#] Nächste Seite
[*] Vorherige Sete
Zur normalen Ansicht wechseln