Help with On Change Event

I have a form with 5 fields (checkboxes) for “Regulatory Items”; each field when checked must also be checked in the corresponding “Approved” field. The user can then select “Approved” from the document status selections when Final. I have (kind of) an On Change Event that won’t allow the document to be saved when the user changes the status to “Approved” if a Regulatory is checked but the approval is not. However, if a user needs to go in after the document is approved and add another Regulatory Field and does not approve it, the document status field is already flagged approved. Is there anything I can do about this? Also, if you Save more than once the save is allowed. I’m pretty inexperienced with this and could really use some help. I need to start learning this yesterday. Thanks! Have included the event below:Sub Onchange(Source As Field)

Dim ws As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Set uidoc = ws.CurrentDocument

uidoc.EditMode = True

Dim AllowChange As Boolean

AllowChange = True



Dim Cat_SOX As String

'Cat_SOX$ = a string

Cat_SOX$ = (uidoc.FieldGetText("Cat_SOX"))

Dim APName1 As String

APName1$ = (uidoc.FieldGetText("APName1"))



Dim Cat_PCI As String

Dim APName2 As String

Cat_PCI$ = (uidoc.FieldGetText("Cat_PCI"))

APName2$ = (uidoc.FieldGetText("APName2"))



Dim Cat_HIPAA As String

Dim APName3 As String

Cat_HIPAA$ = (uidoc.FieldGetText("Cat_HIPAA"))

APName3$ = (uidoc.FieldGetText("APName3"))



Dim Cat_SFR94 As String

Dim APName4 As String

Cat_SFR94$ = (uidoc.FieldGetText("Cat_SFR94"))

APName4$ = (uidoc.FieldGetText("APName4"))



Dim Cat_BP As String

Dim APName5 As String

Cat_BP$ = (uidoc.FieldGetText("Cat_BP"))

APName5$ = (uidoc.FieldGetText("APName5"))



If Doc_Status = "Approved" Then

	AllowChange = True

Elseif Cat_SOX$ <> "" And APName1$ = "" Then 

	AllowChange = False

Msgbox "All Regulatory items must be approved"

Elseif Cat_PCI <> "" And APName2$ = "" Then

	AllowChange = False

Msgbox "All Regulatory items must be approved"

Elseif Cat_HIPAA$ <> "" And APName3$ = "" Then

	AllowChange = False

Msgbox "All Regulatory items must be approved"

Elseif Cat_SFR94$ <> "" And APName4$ = "" Then

	AllowChange = False

Msgbox "All Regulatory items must be approved"

Elseif Cat_BP$ <> "" And APName5$ = "" Then

	AllowChange = False	

Msgbox "All Regulatory items must be approved"

End If	

End Sub

Subject: Help with On Change Event

The good thing is that checkboxes fields can be programmed to trigger document refreshes. What you can do is put some code into the QueryRecalc form event that when circumstances warrant, will change the status back from “Approved” to “Waiting for Approval” (or whatever is the appropriate status level).

Just remember that documents recalc at various times in their lifetime and editing session so code the QueryRecalc event carefully to make sure you reset the status only at the right times.

Subject: Help with On Change Event

I haven’t looked at this in detail, but could you change the document status to something other than Approved whenever the document is edited (is that appropriate)? This would mean anyone changing it would need again to select a doc status of approved, but this could be OK, if the changes made always need document approval anyway.

Cheers,

Adrian