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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form closes and I want to trap that

Status
Not open for further replies.

MkIIISupra

Programmer
Apr 17, 2002
108
US
Okay here is the deal. I have 2 forms that I am using as a generic Audit trail. The primary form frmAuditTrail has a chkBox that when selected will pre-populate a field as well as open another form for more input frmMissingReports, which is used to allow the user the option to select from a series of chkBoxes which reports are missing, then when they submit the input it is appended to the auditDetails field. But I want to capture a cancel command that will allow the user the ability to close the form with no input and reset the intial check box on the frmAuditTrail, how do I trap the exit “code” from the closing form so I can initiate my other functions without an error?

Here is the code I have so far: (Keep in Mind I am still working on this and there is more detail to be added as I implement each new function.)

Code:
Private Sub Form_Activate()
Dim formName_One, formName_Two, formName_Three, formName_Four As String
Dim formName_Five, formName_Six, formName_Seven, formName_Eight As String
Dim a, b, c, d, e, f, g, h, i, j As String
Dim k, l, m, n, o, p, q, r, s, t As Integer
Dim u As Boolean

' Missing Reports module
If (Me.missingReports.Value) = -1 Then

    If ([Forms]![frmMissingReports]![formName]) = False Then
         Exit Sub
    End If
    
    formName_One = [Forms]![frmMissingReports].[formName]
    k = [Forms]![frmMissingReports]![chkIpr] ' Individual Profile Reports
    l = [Forms]![frmMissingReports]![chkSrs] ' School Record Sheet
    m = [Forms]![frmMissingReports]![chkPsr] ' Proficiency Summary
    n = [Forms]![frmMissingReports]![chkWssg] 'Writing Sample by Student Group
    o = [Forms]![frmMissingReports]![chkSss] ' Scale Score Summary
    p = [Forms]![frmMissingReports]![chkIa] ' Item Analysis
    
    If (k) = -1 Then ' Individual Profile Reports
        If IsNull(Me.auditDetails) Then
            Me.auditDetails.Value = "Individual Profile reports are missing."
        Else
            Me.auditDetails.Value = Me.auditDetails & _
                "Individual Profile reports are missing."
        End If
    End If

    If (l) = -1 Then ' School Record Sheet
        If IsNull(Me.auditDetails) Then
            Me.auditDetails.Value = "School Record Sheets are missing."
        Else
            Me.auditDetails.Value = Me.auditDetails & vbCrLf & _
                "School Record Sheets are missing."
        End If
    End If

    If (m) = -1 Then ' Proficiency Summary
        If IsNull(Me.auditDetails) Then
            Me.auditDetails.Value = "Proficiency Summary Reports are missing."
        Else
            Me.auditDetails.Value = Me.auditDetails & vbCrLf & _
                "Proficiency Summary reports are missing."
        End If
    End If

    If (n) = -1 Then 'Writing Sample by Student Group
        If IsNull(Me.auditDetails) Then
            Me.auditDetails.Value = "Writing Sample by Student Group are missing."
        Else
            Me.auditDetails.Value = Me.auditDetails & vbCrLf & _
                "Writing Sample by Student Group are missing."
        End If
    End If

    If (o) = -1 Then ' Scale Score Summary
        If IsNull(Me.auditDetails) Then
            Me.auditDetails.Value = "Scale Score Summary are missing."
        Else
            Me.auditDetails.Value = Me.auditDetails & vbCrLf & _
                "Scale Score Summary are missing."
        End If
    End If

    If (p) = -1 Then ' Item Analysis
        If IsNull(Me.auditDetails) Then
            Me.auditDetails.Value = "Item Analysis Reports are missing."
        Else
            Me.auditDetails.Value = Me.auditDetails & vbCrLf & _
                "Item Analysis Reports are missing."
        End If
    End If

Else
    Exit Sub
End If

End Sub

One by one the penguins steal my sanity!
 
Never mind I figured it out!

Code:
    If (formName_One) = Empty Then
        Exit Sub
    End If

One by one the penguins steal my sanity!
 
Spoke to soon, that delete stuff I selected and said to submit! RATS!

One by one the penguins steal my sanity!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top