From: erik_de_keyser@mickeysnotmail.com   
      
   "Dikkie Dik" wrote in message   
   news:425cf9b9$0$148$e4fe514c@news.xs4all.nl...   
   > I never encountered this myself, but it seems that there are "hanging"   
   > edits without updates or CancelEdits in some of your recordsets. If the   
   > X button is clicked, some events are fired before the form is really   
   > gone. It starts with the QueryUnload event that allows you to cancel the   
   > closing, but if you don't want to cancel it is more clear to use the   
   > Unload event of the form.   
   >   
   > Best regards   
   >   
   > Kevin Robinson schreef:   
   > > Can anyone please help with a problem.   
   > >   
   > > My application uses an Access database and if I use my exit buttons setting   
   > > db to nothing the database   
   > > is closed down correctly.   
   > >   
   > > However if the X is used to exit at the top right hand corner of the form   
   > > then a .idb file remains.   
   > >   
   > > How can I capture the X event so that I can ensure that the DB is closed   
   > > down correctly?   
   > >   
   > >   
   > > Thank in anticipation   
   > >   
   > > Kevin   
   > >   
   > >   
   > >   
   > >   
      
   Kevin, here is the code that's been triggered by the X button   
      
      
      
   Private Sub form_QueryUnload(Cancel As Integer, UnloadMode As Integer)   
   ' If user clicks the No button, stop QueryUnload.   
    If AddEdit = True Then   
    MsgBox "Busy with add , update or edit !", vbOKOnly, Me.Caption   
    Cancel = True   
    ElseIf MsgBox("Back to previous screen ?", vbQuestion + vbYesNo,   
   Me.Caption)   
   = vbNo Then   
    Cancel = True   
    Else   
    Set dataArtikel.Recordset = Nothing   
    Cancel = False   
    End If   
      
   End Sub   
      
      
   HTH   
   Erik.   
   --   
   Erik De Keyser   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|