D Douglas J. Steele Jan 17, 2007 #2 Well, you'll need to have some way of indicating when it's okay to close (i.e.: you'll have to provide a button to let them close the database). Create a module-level variable mbooOkToClose by putting the following line at the beginning of the form's module, before any sub or function: Private mbooOkToClose As Boolean In the Click event of your Close button, see that flag to True: Private Sub cmdClose_Click() mbooOkToClose = True End Sub In the Unload event of the form, put code like: Private Sub Form_Unload(Cancel As Integer) Cancel = (mbooOkToClose = False) End Sub
Well, you'll need to have some way of indicating when it's okay to close (i.e.: you'll have to provide a button to let them close the database). Create a module-level variable mbooOkToClose by putting the following line at the beginning of the form's module, before any sub or function: Private mbooOkToClose As Boolean In the Click event of your Close button, see that flag to True: Private Sub cmdClose_Click() mbooOkToClose = True End Sub In the Unload event of the form, put code like: Private Sub Form_Unload(Cancel As Integer) Cancel = (mbooOkToClose = False) End Sub