Hi
I have a form with some conditions that must be reviewed prior to closing:
None of the conditions are met when the form is first opened. Clicking the CLOSE button, which triggers this code, should result in the form just closing. However, the condition in RED above is triggered even though [ctlGap_Status] = 1.
I'm at a loss here. It worked previously and I made NO changes.
Thanks for any help you can provide.
Jim DeGeorge![[wavey] [wavey] [wavey]](/data/assets/smilies/wavey.gif)
I have a form with some conditions that must be reviewed prior to closing:
Code:
If Not IsNull([ctlDateClosed]) And ((Not IsNull(Me!ctlResolution)) Or Me!ctlResolution <> "") And [ctlGap_Status] = 1 Then
strMsg = "RESOLUTION and DATE CLOSED fields cannot be entered"
strMsg = strMsg & vbCrLf & "without changing the STATUS to CLOSED."
strMsg = strMsg & vbCrLf & "Click OK to correct."
MsgBox strMsg, 16, "Conversion Gap Analysis"
RecordInvalid = True
Exit Function
ElseIf Not IsNull([ctlDateClosed]) And (IsNull(Me!ctlResolution) Or Me!ctlResolution = "") And [ctlGap_Status] <> 1 Then
strMsg = "STATUS cannot be set to CLOSED"
strMsg = strMsg & vbCrLf & "and DATE CLOSED cannot be entered without"
strMsg = strMsg & vbCrLf & "entering a detailed RESOLUTION."
strMsg = strMsg & vbCrLf & "Click OK to correct."
MsgBox strMsg, 16, "Conversion Gap Analysis"
RecordInvalid = True
Exit Function
ElseIf Not IsNull([ctlDateClosed]) And (IsNull(Me!ctlResolution) Or Me!ctlResolution = "") And [ctlGap_Status] = 1 Then
strMsg = "DATE CLOSED cannot be entered without"
strMsg = strMsg & vbCrLf & "changing STATUS to CLOSED and"
strMsg = strMsg & vbCrLf & "entering a detailed RESOLUTION."
strMsg = strMsg & vbCrLf & "Click OK to correct."
MsgBox strMsg, 16, "Conversion Gap Analysis"
RecordInvalid = True
Exit Function
ElseIf IsNull([ctlDateClosed]) And ((Not IsNull(Me!ctlResolution)) Or Me!ctlResolution <> "") And [ctlGap_Status] <> 1 Then
strMsg = "RESOLUTION cannot be entered and"
strMsg = strMsg & vbCrLf & "STATUS cannot be set to CLOSED"
strMsg = strMsg & vbCrLf & "without DATE CLOSED being completed."
strMsg = strMsg & vbCrLf & "Click OK to correct."
MsgBox strMsg, 16, "Conversion Gap Analysis"
RecordInvalid = True
Exit Function
ElseIf IsNull([ctlDateClosed]) And ((Not IsNull(Me!ctlResolution)) Or Me!ctlResolution <> "") And [ctlGap_Status] = 1 Then
strMsg = "RESOLUTION cannot be entered without"
strMsg = strMsg & vbCrLf & "STATUS being set to CLOSED and"
strMsg = strMsg & vbCrLf & "without DATE CLOSED being completed."
strMsg = strMsg & vbCrLf & "Click OK to correct."
MsgBox strMsg, 16, "Conversion Gap Analysis"
RecordInvalid = True
Exit Function
[b][COLOR=red]ElseIf IsNull([ctlDateClosed]) And (IsNull(Me!ctlResolution) Or Me!ctlResolution = "") And [ctlGap_Status] <> 1 Then[/color][/b]
strMsg = "STATUS cannot be set to CLOSED"
strMsg = strMsg & vbCrLf & "without entering a detailed RESOLUTION"
strMsg = strMsg & vbCrLf & "and without DATE CLOSED being completed."
strMsg = strMsg & vbCrLf & "Click OK to correct."
MsgBox strMsg, 16, "Conversion Gap Analysis"
RecordInvalid = True
Exit Function
Else
If ctlAssessment = "" Then
Dim msg, DgDef, Response As Variant
Beep
msg = "You must enter a detailed Assessment. " _
& vbCrLf & "Click OK to try again!"
DgDef = MB_OK + MB_ICONINFORMATION + MB_DEFBUTTON2
Response = MsgBox(msg, DgDef, Title)
ctlAssessment.SetFocus
RecordInvalid = True
Exit Function
Else
DoEvents
End If
End If
I'm at a loss here. It worked previously and I made NO changes.
Thanks for any help you can provide.
Jim DeGeorge
![[wavey] [wavey] [wavey]](/data/assets/smilies/wavey.gif)