Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: UI freezes on DoCmd.Close

Geek News

UI freezes on DoCmd.Close
cbfuk 12/13/2008 2:51:02 AM
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?


Re: UI freezes on DoCmd.Close
"tkelley via AccessMonster.com" <u47368[ at ]uwe> 12/15/2008 10:07:42 PM
"with a DoCmd.Close (fired
from the OnClose event of a "Close" button on the form)"

Am I the only one confused by this? I'm not even sure what "the OnClose
event of a 'Close' button" means. If you want the form to close after
clicking a button, why don't you have your DoCmd.Close statement in the
OnClick event?

Or am I missing something?

cbfuk wrote:
[Quoted Text]
>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?

--
Message posted via http://www.accessmonster.com

Re: UI freezes on DoCmd.Close
cbfuk 12/16/2008 6:33:01 PM
Sorry all, stupid typo - should have said "fired on the OnClick event" for
the button. :-8


"tkelley via AccessMonster.com" wrote:

[Quoted Text]
> "with a DoCmd.Close (fired
> from the OnClose event of a "Close" button on the form)"
>
> Am I the only one confused by this? I'm not even sure what "the OnClose
> event of a 'Close' button" means. If you want the form to close after
> clicking a button, why don't you have your DoCmd.Close statement in the
> OnClick event?
>
> Or am I missing something?
>
> cbfuk wrote:
> >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?
>
> --
> Message posted via http://www.accessmonster.com
>
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net