Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Jamie Osborn
  Where is Jamie Osborn?
 Jamie Osborn
 To: Tom Findlay
 Tom Findlay
Subject: RE: NOSHOW and Release quandry
Thread ID: 16254 Message ID: 16269 # Views: 0 # Ratings: 0
Version: Unknown Category: General VFP Topics
Date: Tuesday, October 15, 2002 1:45:24 AM         

> Hi all,
> I am calling a form with NOSHOW on occasions as I only want the calculations that the form does performed, I do not want the form to appear. However, if I call the form with NOSHOW and issue a THISFORM.Release, the tables which are in the form's data environment are left open. I have the form set to use a Private Data Session and to auto close the tables. Does anyone have any idea why the tables are not closed when NOSHOW is issued and the form is released and more importantly does anyone know how I might work around the problem?
> Thanks in advance
> Tom

You could always explicitly issue this.dataenvironment.closetables() in the form to close them.

Having said that .......
Your problem actually stems from the fact that you have code in the wrong place - you haven't seperated the interface from the implementation.

What you should have is the business logic that you are needing to call on your form in a custom object or UDF. The form should then call the UDF() or (preferably) instantiate the object with the business logic in it (a business object if you will) and get the info it needs.

eg. If you have a customer form and want to bring up a list of customers who owe you money you could create a customer business object, add a method to it called GetOwing() in which you put code to create a cursor with the relevant customers in it and the form instantiate that object and call the Getowing() method to get the cursor it needs.
This means that any other time you need that list of customers you can just instantiate the customer business object and call the GetOwing() method - from other forms or reports etc.



NOSHOW and Release quandry Posted by Tom Findlay @ 10/14/2002 1:33:48 PM
RE: NOSHOW and Release quandry Posted by Jamie Osborn @ 10/15/2002 1:45:24 AM
RE: NOSHOW and Release quandry Posted by Tom Findlay @ 10/15/2002 10:43:39 AM