Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Closing tables defined in the data environment

Status
Not open for further replies.

AndrewMozley

Programmer
Oct 15, 2005
621
GB
I have an application which includes a class of utility functions; this class opens several tables (non-exclusive) in a separate data session, and its methods are invoked from several forms. I instantiate this class (as anm_util) when the application fires up.

One of the forms (say EXCL_FORM), however, likes to have exclusive use of several tables. Accordingly I include code before I run this form.
Code:
RELEASE anm_util

This works fine so far. The tables specified in the data environment of EXCL_FORM are opened, and the form runs.

When this form finishes I would like to re-instantiate anm_util. To do this I need the tables used by EXCL_FORM to have been closed. Putting a break-point into the Unload() or Release() methods of EXCL_FORM, even after their DEFAULT() methods have run, does not help; All the tables specified in the data environment are still open.

I would like to know how I can arrange to execute some code (re-instantiating anm_util) after all the tables specified in the data environment of EXCL_FORM have been closed.

Thanks
 
Well, you look into form methods when you want to react to the data environment having unloaded. The data environment has an event "AfterCloseTables", which should be good for your case.
On the other side its questionable you need exclusive access to any table in any form of a multi user environment. but that's another story and needs more time to change.

Bye, Olaf.
 
Hello Olaf. I had not noticed that the data environment had its own methods, separate to the methods of its parent form!

The tables are indeed no longer open during this method, so I have been able to reinstate my anm_util object, re-opening tables as necessary.

Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top