Melissa,
You're thinking along the right lines.
Here's code from the unload event of my switchboard form, which is never closed (though it's often invisible):
Private Sub Form_Unload(cancel As Integer)
On Error GoTo Error
If AllowExit = False Then
cancel = True
End If
Exit Sub
Error:
ErrorTrap Err.Number, Err.Description, "Form Unload", "frmSwitchboard"
End Sub
Errortrap is my standard error handler. You'll want to change that to whatever you use.
AllowExit is a boolean function that checks the tag of the close button on this form. Here's that function:
Public Function AllowExit() As Boolean
'(c)Copyright 2/6/01 Jeremy Wallace
On Error GoTo Error
Dim sSql As String
If Forms!frmswitchboard!cmdQuit.Tag = "allow exit" Then
AllowExit = True
Else
AllowExit = False
MsgBox "To close this application, first close all forms and the click 'Quit' on the" _
& " Switchboard form.", vbExclamation
End If
Exit Function
Error:
ErrorTrap Err.Number, Err.Description, "AllowExit"
End Function
Oh, and the event for cmdQuit first sets the tag to "allow exit" and then calls application.quit.
Hope this helps.
Jeremy =============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995
Take a look at the Developer's section of the site for some helpful fundamentals.
Remember to reward helpful tips with the stars they deserve.