Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Grigore Dolghin
  Where is Grigore Dolghin?
 Bucharest
 Romania
 Grigore Dolghin
 To: Adel Kadi
  Where is Adel Kadi?
 Fairfax
 Virginia - United States
 Adel Kadi
 Tags
Subject: RE: Return Value From Another Form
Thread ID: 668 Message ID: 670 # Views: 1 # Ratings: 0
Version: Unknown Category: General VFP Topics
Date: Saturday, June 09, 2001 4:40:22 PM         
   


> I have an application like Address Book and i am trynig to do a button that says (Calls for this customer) the when it is pushed will open another form showing all this customer or client
> calls so what is the easiest way to do it?
> kadi

Is hard to say. The best approach depends on what do you have in the forms' dataenvironment and on what you intend to do in the second form.

Suppose you have two tables, named "customers" and "calls", and the button "Calls for this customer" is named button1:

a) If you do not have anything in DE, and open the tables manually, with USE:

In button1 click method:

DO FORM calls WITH customers.id

In the "Calls" form INIT method, the code should be:

LPARAMETERS cust_id
USE calls
SET FILTER TO customer = cust_id && customer is a field in "calls" table, identifying the customer's calls

b) If you have the tables in dataenvironment, the approach will be the same

c) the best way, in my opinion, is to have a parameterized view in "calls" form (in DataEnvironment).

c.1.) If you are using a database, define a local parameterized view there. Check the help file. Then add it in the "calls" form, and set the NoDataOnLoad property to .F.

In the "calls" INIT method, place the following code:

LPARAMETERS custid && change this with the exact name of the parameter in the parameterized view
REQUERY(the_name_of_the_view)

c.2.) If you aren't, you can define the view on-the-fly, in the "calls" form INIT method, using a SQL - SELECT command:

LPARAMETERS custid
SELECT * FROM calls WHERE customer = custid INTO CURSOR crCalls

And then you can use this cursor to display the calls.

Note: If you want to update the calls, also, I recommend c.1. If you are sticking on the c.2, you'll have to set some properties to make the cursor send the updates back to the base table. Check the help file on CURSORSETPROP(). It's too much to cover the command here.


Hope this helps,
Grigore Dolghin
Class Software

ENTIRE THREAD

Return Value From Another Form Posted by Adel Kadi @ 6/9/2001 2:40:11 PM
RE: Return Value From Another Form Posted by Grigore Dolghin @ 6/9/2001 4:40:22 PM
RE: Return Value From Another Form Posted by Adel Kadi @ 6/10/2001 2:01:26 PM
RE: Return Value From Another Form Posted by Ryss Unger @ 6/10/2001 4:07:37 PM
RE: Return Value From Another Form Posted by Grigore Dolghin @ 6/10/2001 7:45:59 PM