C
cbfuk
I have a bound Form which does not close properly with a DoCmd.Close (fired
from the OnClose event of a "Close" button on the form). When this executes,
the Form does close (because pressing Enter will open it again from the
selected control on the form beneath which launched it in the first place)
but the Access UI completely freezes, with the form remaining displayed.
I've tried all the obvious (and not-so-obvious) things, such as repairing,
rebuilding by copying all objects into an empty, fresh DB, and saving the
form as text/deleting/reloading it, all to no effect. This is a problem
specific to this form, btw - DoCmd.Close works fine on other forms, so it
isn't a system-wide problem. The behaviour is also completely repeatable, in
both 2k3 and 2k7 and on multiple PCs. (The MDB is still in Access 2000
format, though it doesn't have any data - it's just a front-end app linked to
a MySQL DB via ODBC)
The form does not save data on exit (that's handled direcly by VBA code;
there's just a Me.Undo in Form_BeforeUpdate and nothing in Form_AfterUpdate).
However, it is bound (via a RecordSource query) to linked ODBC tables, so I
wondered if it was hanging for some reason on remote data access. I've tried
setting Me.RecordSource = "" though immediately before the Close, to no
effect - so I think that might be a red herring.
Weirdly, closing the form by attaching a *macro* to my "Close" button's
OnClick *does* work find - every time - as does closing with the window X
button - the failure only happens when VBA is involved. Running a
DoCmd.RunMacro doesn't help either - still hangs! The macro only works if
associated *directly* with the OnClick!
Well, I'm out of ideas. Anyone got any suggestions?
from the OnClose event of a "Close" button on the form). When this executes,
the Form does close (because pressing Enter will open it again from the
selected control on the form beneath which launched it in the first place)
but the Access UI completely freezes, with the form remaining displayed.
I've tried all the obvious (and not-so-obvious) things, such as repairing,
rebuilding by copying all objects into an empty, fresh DB, and saving the
form as text/deleting/reloading it, all to no effect. This is a problem
specific to this form, btw - DoCmd.Close works fine on other forms, so it
isn't a system-wide problem. The behaviour is also completely repeatable, in
both 2k3 and 2k7 and on multiple PCs. (The MDB is still in Access 2000
format, though it doesn't have any data - it's just a front-end app linked to
a MySQL DB via ODBC)
The form does not save data on exit (that's handled direcly by VBA code;
there's just a Me.Undo in Form_BeforeUpdate and nothing in Form_AfterUpdate).
However, it is bound (via a RecordSource query) to linked ODBC tables, so I
wondered if it was hanging for some reason on remote data access. I've tried
setting Me.RecordSource = "" though immediately before the Close, to no
effect - so I think that might be a red herring.
Weirdly, closing the form by attaching a *macro* to my "Close" button's
OnClick *does* work find - every time - as does closing with the window X
button - the failure only happens when VBA is involved. Running a
DoCmd.RunMacro doesn't help either - still hangs! The macro only works if
associated *directly* with the OnClick!
Well, I'm out of ideas. Anyone got any suggestions?