Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Ryss Unger
  Where is Ryss Unger?
 Cape Town
 South Africa
 Ryss Unger
 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: 677 # Views: 1 # Ratings: 0
Version: Unknown Category: General VFP Topics
Date: Sunday, June 10, 2001 4:07:37 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
>
> Thanks very much for taking the time to help I tried all of the ideas but non works and
> i am still trying.
> thanks again.
>
> kadi
Hi Kadi
Gee I thought Grigore gave you a good answer. Can I simply it?.. will try.

In the current form you have a number of options:-
1. use a pageframe or a seperate form to show the Calls
2. I would add the calls tabel to the form you have now and set the relation between Address Book and calls. Can you do this?
Or you can open the Calls table in the new form but rather not, I think.

So if we go for a new form create the form as you require it then delete the table from this form as it will be opened from the former form.

Form one must not be a private data session

And that should be all you need to do. When you open the Calls form it should show the calls relative to the Address Book entry that the record pointer was on when the user clicked the relevant button.

Let us now how you get along ...but we will need specific problems if u get stuck so we can help you.


Regards
Ryss

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