Moin Bernhard,
im Postopen les ich die Werte zum Beispiel folgendermaßen ein:
Function Zone_Postopen(source As NotesUIDocument) As Boolean
'*********************************************************************************************************************************
'save the current values of the form Zone to verify in the function Zone_ValuesChanged of this library if
'they were changed. Returns true in any case excluding errors. Invoked from the event Postopen of the form Zone
'*********************************************************************************************************************************
'used libraries: logging
'used functions: CreateLogEntry(DBName As String, User As String, DesignElement As String, InvokingEvent As String, _
' Text As String)
'
'Parameters: source = current zone
'
'*********************************************************************************************************************************
On Error Goto ErrHandle
'*********************************************************************************************************************************
If Not source.IsNewDoc Then
'save old field values for comparing in the function Zone_ValuesChanged in this lib
Call CreateLogEntry(libZO_DB.title,libZO_Session.CommonUserName,"Scriptbibliothek: lib_Zone","Zone_Postopen",_
"globale Variablen setzen um für Zone: " & source.FieldGetText("ID") & " einen Vergleich auf Änderung durchführen zu können")
strZO_IDOLD = source.FieldGetText("ID")
strZO_EffectiveFromOLD = source.FieldGetText("EffectiveFrom")
strZO_AverageDistanceOLD = source.FieldGetText("AverageLinearDistance")
strZO_ProvisionOLD = source.FieldGetText("Provision")
Call CreateLogEntry(libZO_DB.title,libZO_Session.CommonUserName,"Scriptbibliothek: lib_Zone","Zone_Postopen",_
"globale Variablen ausgelesen")
Else
Call CreateLogEntry(libZO_DB.title,libZO_Session.CommonUserName,"Scriptbibliothek: lib_Zone","Zone_Postopen",_
"Zone: " & source.FieldGetText("ID") & " wird bearbeitet")
End If
'RETURN
Zone_Postopen = True
Leave:
Exit Function
ErrHandle:
Call CreateLogEntry(libZO_DB.title,libZO_Session.CommonUserName,"Scriptbibliothek: lib_Zone","Zone_Postopen",_
"Error" & Str(Err) & ": " & Error$ & " in Zeile " & Erl)
'RETURN
Zone_Postopen = False
Resume Leave
End Function
Im Querysave hol ich mir dann die eventuell geänderten Werte ähnlich:
Function Zone_Querysave(source As NotesUIDocument) As Boolean
'*********************************************************************************************************************************
'saves the current field values of the form Zone to compare them with the values which were saved in the
'function Zone_Postopen of this library. Invoked from the event Querysave of the form Zone.
'*********************************************************************************************************************************
'used libraries: logging, this lib
'used functions: Zone_VerifyInput(source As NotesUIDocument) As Boolean
' Zone_NotExist(source As NotesUIDocument) As Boolean
' CreateLogEntry(DBName As String, User As String, DesignElement As String, InvokingEvent As String, _
' Text As String)
'
'Parameters: source = current zone
'*********************************************************************************************************************************
On Error Goto ErrHandle
'*********************************************************************************************************************************
'verify user input
If Zone_VerifyInput(source) = False Then
Call CreateLogEntry(libZO_DB.title,libZO_Session.CommonUserName,"Scriptbibliothek: lib_Zone","Zone_Querysave",_
"Felder nicht korrekt ausgefüllt")
'RETURN
Zone_QuerySave = False
Exit Function
End If
Call CreateLogEntry(libZO_DB.title,libZO_Session.CommonUserName,"Scriptbibliothek: lib_Zone","Zone_Querysave",_
"Felder korrekt ausgefüllt")
'Verify if the ID allready exists. Else exit function with false
If Source.IsNewDoc Then
If Zone_NotExist(source) = False Then
Call CreateLogEntry(libZO_DB.title,libZO_Session.CommonUserName,"Scriptbibliothek: lib_Zone","Zone_Querysave",_
"Zone_QuerySave = False - speichern verhindert")
'RETURN
Zone_QuerySave = False
Exit Function
End If
Else
'read new field values for compare with old field values
strZO_IDNEW = source.FieldGetText("ID")
strZO_EffectiveFromNEW = source.FieldGetText("EffectiveFrom")
strZO_AverageDistanceNEW = source.FieldGetText("AverageLinearDistance")
strZO_ProvisionNEW =source.FieldGetText("Provision")
If Zone_ValuesChanged = False Then
Msgbox "Es wurden keine gültigen Änderungen festgestellt. Speichern wird abgebrochen.",,"DORNHÖFER GmbH"
'RETURN
Zone_QuerySave = False
Exit Function
End If
End If
'RETURN
Zone_Querysave = True
Leave:
Exit Function
ErrHandle:
Call CreateLogEntry(libZO_DB.title,libZO_Session.CommonUserName,"Scriptbibliothek: lib_Zone","Zone_Querysave",_
"Error" & Str(Err) & ": " & Error$ & " in Zeile " & Erl)
'RETURN
Zone_Querysave = False
Resume Leave
End Function
Zu diesem Zeitpunkt würde mir source.document.Provision(0) für strZO_ProvisionNEW ja noch den zuletzt gespeicherten Wert zurückgeben und nicht den neu eingegebenen, oder nicht?