469,609 Members | 2,250 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,609 developers. It's quick & easy.

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


Jul 17 '05 #1
2 6724
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

Jul 17 '05 #2
"Dikkie Dik" <no****@nospam.org> wrote in message
news:42*********************@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
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by William C. White | last post: by
2 posts views Thread by Albert Ahtenberg | last post: by
3 posts views Thread by James | last post: by
reply views Thread by Ollivier Robert | last post: by
1 post views Thread by Richard Galli | last post: by
4 posts views Thread by Albert Ahtenberg | last post: by
1 post views Thread by inderjit S Gabrie | last post: by
2 posts views Thread by Jack | last post: by
3 posts views Thread by Sandwick | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.