' variable global to defect module
dim CommentFieldFlag
Function Defects_Bug_CanPost
On Error Resume Next
' checks for Status of "Fixed" and comments flag = true else allows the user post defect
If Not Bug_Fields("BG_BUG_ID").IsNull AND Bug_Fields("BG_STATUS").Value = "Fixed" Then
If CommentFieldFlag = True then
Defects_Bug_CanPost = True
Else
Defects_Bug_CanPost = False
MsgBox "lease add a comment (using the Add Comments button) with information about the fix.",VbInformation ,"No Comment Warning"
End If
Else
Defects_Bug_CanPost = True
End If
'comment out or delete this next line if there by default
'Defects_Bug_CanPost = Project_DefaultRes
On Error GoTo 0
End Function
Sub Defects_Bug_AfterPost
On Error Resume Next
' resets the flag after each defect is posted
CommentFieldFlag = False
On Error GoTo 0
End Sub
Sub Defects_EnterModule
On Error Resume Next
' initialises flag
CommentFieldFlag = False
On Error GoTo 0
End Sub
Sub Defects_Bug_FieldChange(FieldName)
On Error Resume Next
' sets flag for comments when comments updated
If FieldName = "BG_DEV_COMMENTS" then
CommentFieldFlag = True
End If
On Error GoTo 0
End Sub