Peripheal
asked on
Cause of a checkbox field to disappear with a backend save call?
I have a piece of code in the QueryOpen of a document which works in the backend of the doc and calls a back end save. When this code is in place, the one checkbox field I have the form totally disappears. This same piece of code works well in another form with a checkbox field in it. The form properties are the same with the exception of the non-working form has 'Formulas inherit values from selected document'. But there is no formula in the Lock field. Here is the code:
'If doc is new document then exit sub
If (Source.IsNewDoc) Then
Exit Sub
End If 'New Doc, Lock not reqd
Dim varLock As Variant
Dim session As New NotesSession
Dim nnUserName As New NotesName(session.UserName )
'Grab the backend document to do the work there
Set docBackend=Source.document
'Get the lock field
varLock=docBackend.GetItem Value("Loc k")
'If lock field is not empty - put up message
If (varLock(0) <> "") Then
Msgbox ("Document is currently locked by "+varLock(0)+". A read-only copy will be opened for your use.")
Exit Sub
End If
'put current user name in lock field to keep doc locked until done editing.
docBackend.Lock=nnUserName .Common
Call docBackend.Save(True,True)
The last line is the culprit which makes the checkbox field disappear. Any insight is greatly appreciated!
'If doc is new document then exit sub
If (Source.IsNewDoc) Then
Exit Sub
End If 'New Doc, Lock not reqd
Dim varLock As Variant
Dim session As New NotesSession
Dim nnUserName As New NotesName(session.UserName
'Grab the backend document to do the work there
Set docBackend=Source.document
'Get the lock field
varLock=docBackend.GetItem
'If lock field is not empty - put up message
If (varLock(0) <> "") Then
Msgbox ("Document is currently locked by "+varLock(0)+". A read-only copy will be opened for your use.")
Exit Sub
End If
'put current user name in lock field to keep doc locked until done editing.
docBackend.Lock=nnUserName
Call docBackend.Save(True,True)
The last line is the culprit which makes the checkbox field disappear. Any insight is greatly appreciated!
Put into Lock field default value this formula:
Lock
Please be aware that the name of the field has to be without quotas.
Good luck,
Zvonko
Lock
Please be aware that the name of the field has to be without quotas.
Good luck,
Zvonko
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Scott,
Thank you for the information. Another one of those wonderful features of Notes! I just added a default value in the checkbox field to make it work. That's not what I wanted to do, but I can live with it.
I appreciate your time!
Have a great weekend!
Lisa
Thank you for the information. Another one of those wonderful features of Notes! I just added a default value in the checkbox field to make it work. That's not what I wanted to do, but I can live with it.
I appreciate your time!
Have a great weekend!
Lisa
Hi Lisa,
Glad to hear you were able to use a workaround. Believe me, I have seen Notes do much weirder things than this :-)
Have a great weekend as well.
Regards,
Scott
Glad to hear you were able to use a workaround. Believe me, I have seen Notes do much weirder things than this :-)
Have a great weekend as well.
Regards,
Scott
~Hemanth