All,
I have an existing form with a controlled access section. I have tried both Computed for Display and Computed. The formula looks to a hidden field on the form with the following formula:
who := @Sort(
@Unique(
@Name([CN];@DbLookup(“”:“NoCache”;“Edison/SEL”:“Names.nsf”; “($VIMGroups)”;“CSR” ; 3)):
@Name([CN];@DbLookup(“”;“Edison/SEL”:“Names.nsf”; “($VIMGroups)”;“LocalDomainAdmins” ; 3))
));
@If(Status = “” : “New” : “New Doc” : “Modified”;
@Name([ABBREVIATE];who ); “No Access”)
In the Querymodechange I have code to see what the status is. If it is in the Approved status then a prompt will come up asking if they want to edit. If yes, it opens in edit mode and chanes the status to Modified.
After the form opens in edit mode though, the section is not editable. That is if you click on the section a prompt comes up with my name and others as to who can edit it, but nothing within that section is editable.
Here is the code for the Querymodechange:
Dim wksp As New NotesUIWorkspace
Dim session As New NotesSession
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim strFieldname As String
Set uidoc = wksp.CurrentDocument
Set doc = uidoc.Document
If Not ( source.EditMode ) Then
currentStatus = source.FieldGetText( "Status" )
If ( currentStatus = "CFG" ) Then
Dim roles As Variant
roles = Evaluate ( { @IsMember("[SSMFG]";@UserRoles) } )
If roles(0) = 1 Then
Continue=True
Else
Msgbox "Document available for viewing only and cannot be edited"
continue=False
End If
Elseif (currentStatus = "ECO") Then
Dim roles1 As Variant
roles1 = Evaluate ( { @IsMember("[SSMFG]";@UserRoles) } )
If roles1(0) = 1 Then
Continue=True
Else
Msgbox "Document available for viewing only and cannot be edited"
continue=False
End If
Elseif (currentStatus = "MFG") Then
Dim roles2 As Variant
roles2 = Evaluate ( { @IsMember("[SSMFG]";@UserRoles) } )
If roles2(0) = 1 Then
Continue=True
Else
If Messagebox _
("This document is in review by MFGing! If you wish to continue to edit this document, then the Status will chane to Modified. Do you want to continue?", _
MB_YESNO, "CAUTION -- DOCUMENT -- IN MFG REVIEW") = IDYES Then
Else
Msgbox "Document open for viewing. Thank You! ", MB_ICONINFORMATION, "Viewing Only"
continue=False
End If
End If
Elseif (currentStatus = "Approved") Then
If Messagebox _
("You are about to edit an Approved document. This will change the Status to Modified. Do you want to continue?", _
MB_YESNO, "CAUTION -- APPROVED -- DOCUMENT") = IDYES Then
doc.CSRSection = ""
Call doc.ComputeWithForm(True, False)
'uidoc.Refresh True
'uidoc.RefreshHideFormulas
'Call uidoc.Reload
Else
Msgbox "Document open for viewing. Thank You! ", MB_ICONINFORMATION, "Viewing Only"
continue=False
End If
End If
End If
As you can possibly see I did try to do a uidoc, refresh/reload but the section is still not editable but my name is listed as an Editor.
I had also tried a refresh code from a button thinking I could alter it to work with the rest that I got from this forum (This code is working in another database to refresh subforms when the user decides they want something different without saving/closing/re-opening):
Dim wksp As New NotesUIWorkspace
Dim session As New NotesSession
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim rti As NotesRichTextItem
Dim Ph1 As Variant
Dim dst As NotesRichTextItem
Dim strFieldname As String
Set uidoc = wksp.CurrentDocument
uidoc.Refresh True
Set doc = uidoc.Document
strFieldname = uidoc.CurrentField
Call doc.ComputeWithForm(True, False)
doc.SaveOptions = "0"
Call uidoc.Close
Dim uidocNew As NotesUIDocument
Set uidocNew = wksp.EditDocument(True, doc, , , , True)
Delete uidoc
uidocNew.Document.RemoveItem("SaveOptions")
If strFieldname <> "" Then uidocNew.GotoField(strFieldname)
This code kept giving me an Object Variable Not Set error. When I looked at the debugger it would stop on the uiidocNew.Document.RemoveItem line.
Any help would be appreciated.
Cheers,
Teri