Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Boolean Craziness!!

Status
Not open for further replies.

jdegeorge

Programmer
Mar 19, 2002
1,313
US
Hi

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
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]
 
PLEASE IGNORE...I copied in the wrong code!!!

Sorry![nosmiley]

Jim DeGeorge [wavey]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top