VB6 DAO

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kevin Robinson

    #1

    VB6 DAO

    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




  • Dikkie Dik

    #2
    Re: VB6 DAO

    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:[color=blue]
    > 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
    >
    >
    >
    >[/color]

    Comment

    • Erik De Keyser

      #3
      Re: VB6 DAO

      "Dikkie Dik" <nospam@nospam. org> wrote in message
      news:425cf9b9$0 $148$e4fe514c@n ews.xs4all.nl.. .[color=blue]
      > 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:[color=green]
      > > 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
      > >
      > >
      > >
      > >[/color][/color]

      Kevin, here is the code that's been triggered by the X button



      Private Sub form_QueryUnloa d(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.Rec ordset = Nothing
      Cancel = False
      End If

      End Sub


      HTH
      Erik.
      --
      Erik De Keyser


      Comment

      Working...