Acc97: Application.Quit hangs task 
Author Message
 Acc97: Application.Quit hangs task

In Access97 I have a command button with the simple code of:

Application.Quit

on the OnClick event.

When I run the program in a runtime environment on an NT4.0 desktop,
the task won't shutdown completely. The window closes, but the task
tab stays active. I have to use Task Manager to manually end the task.

It shuts down fine when not run in the runtime mode.

Any suggestions?

Thanks.

Denny
------------------
Denny Pasternak
FDC - Teleservices
Omaha, NE



Fri, 04 Oct 2002 03:00:00 GMT  
 Acc97: Application.Quit hangs task
Known bug, caused by an object reference that was not
correctly released. It takes some time to track this
one down, but there are 2 things to look for:

1. Boolean Controls:
===================
You referenced a check box, option button, or toggle button
like this:
        If Me.chk Then
intending Access to understand interpret this as meaning the
default property (.Value). However, Access passed down an
object reference that is never relesed. Change your code to
explicitly reference the property, i.e.:
        If Me.chk.Value Then

2. Objects not set to Nothing:
=============================
Access does a pretty good job of closing what you open and
dereferencing what you assign, but you cannot rely on it to
do so. Especially recordsets must be explicitly closed and
set to nothing. You need to make sure this happens regardless
of how the proc is terminated. Example:
---------------------------------
Function MyFunc
On Error GoTo Err_MyFunc
  Dim db as Database
  Dim rst as Recordset

  Set db = CurrentDb()
  Set rst = db.OpenRecordset(...

  'Explictly close what you opened.
  rst.Close

Exit_MyFunc
  'Explicitly set all objects to Nothing here. Generally use
  '     reverse order, so as to handle dependencies.
  Set rst = Nothing
  Set db = Nothing
  Exit Function

Err_MyFunc:
  'error handler
  Resume Exit_MyFunc
End Function
---------------------------------

Quote:

> In Access97 I have a command button with the simple code of:

> Application.Quit

> on the OnClick event.

> When I run the program in a runtime environment on an NT4.0 desktop,
> the task won't shutdown completely. The window closes, but the task
> tab stays active. I have to use Task Manager to manually end the task.

--
Perth, Western Australia
Tips for MS Access users at:
        http://odyssey.apana.org.au/~abrowne


Sat, 05 Oct 2002 03:00:00 GMT  
 Acc97: Application.Quit hangs task
Thank you for the very clear and thourough reply.

Denny

On Tue, 18 Apr 2000 06:01:28 GMT, Allen Browne

Quote:

>Known bug, caused by an object reference that was not
>correctly released. It takes some time to track this
>one down, but there are 2 things to look for:

>1. Boolean Controls:
>===================
>You referenced a check box, option button, or toggle button
>like this:
>    If Me.chk Then
>intending Access to understand interpret this as meaning the
>default property (.Value). However, Access passed down an
>object reference that is never relesed. Change your code to
>explicitly reference the property, i.e.:
>    If Me.chk.Value Then

>2. Objects not set to Nothing:
>=============================
>Access does a pretty good job of closing what you open and
>dereferencing what you assign, but you cannot rely on it to
>do so. Especially recordsets must be explicitly closed and
>set to nothing. You need to make sure this happens regardless
>of how the proc is terminated. Example:
>---------------------------------
>Function MyFunc
>On Error GoTo Err_MyFunc
>  Dim db as Database
>  Dim rst as Recordset

>  Set db = CurrentDb()
>  Set rst = db.OpenRecordset(...

>  'Explictly close what you opened.
>  rst.Close

>Exit_MyFunc
>  'Explicitly set all objects to Nothing here. Generally use
>  ' reverse order, so as to handle dependencies.
>  Set rst = Nothing
>  Set db = Nothing
>  Exit Function

>Err_MyFunc:
>  'error handler
>  Resume Exit_MyFunc
>End Function
>---------------------------------


>> In Access97 I have a command button with the simple code of:

>> Application.Quit

>> on the OnClick event.

>> When I run the program in a runtime environment on an NT4.0 desktop,
>> the task won't shutdown completely. The window closes, but the task
>> tab stays active. I have to use Task Manager to manually end the task.

------------------
Denny Pasternak
FDC - Teleservices
Omaha, NE


Sat, 05 Oct 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Repost -- ACC97: GPF on Application.Quit

2. ACC97: GPF on Application.Quit (and shutdown problem)...

3. Application.Quit but Word remains open in Task Manager

4. W2k Task-Scheduler -> find hanging tasks

5. ACC97: Quit Access

6. Access remains Hanging after Quit

7. Inet QUIT, CLOSE and Cancel hangs

8. VB App hanging around--won't quit

9. Outlook hangs under Windows NT Task Scheduler

10. Run backround application without being listed among the applications of the windows task manger

11. Run backround application without being listed among the applications of the windows task manger

12. Application seen at Task Manager but no display from application

 

 
Powered by phpBB® Forum Software