Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Accessing one form from another in VFP & populating the
Message
 
 
To
09/07/2005 14:21:23
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 8
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01030929
Message ID:
01030947
Views:
15
Paul,

One way to deal with this is to make project_client a private datasession form, then set project_tasks to default datasession. When the child form is launched from inside the parent form it'll be running in the private data session so it has access to all the tables opened by he parent. The cild form can tell what client is selected because you'll be sitting on that row.

If you need to carry out more complicated interform communication and don't mind the close coupling you can pass a reference to the parent form to the child:
do form project_tasks with thisform
>I have a project with client information in one project. call this project_client. I also have a project that has the tasks to be completed for each client. call this project_tasks
>
>What I'm Looking to Do:
>I want to access one form in project_tasks from a form in project_client. When someone is looking up information on a client, I want them to be able to click on a command button and access a form that lists all of the tasks for that client. It should already have the tasks selected for that specific client. The tasks cannot simply be listed as a report since the tasks form has capacity to make changes to the tasks, which I need. Both projects work well on their own, but looking up client information in one form and then having to open another form and then search for the same client to look at their tasks gets tedious.
>
>Background on my forms:
>The form listing the tasks has a combo box on the top in which all the clients are listed. The form also has a large list box populated with the tasks to be completed. The combobox is populated by a requery select statement that selects information from the client table into a cursor, and the init of the combobox lists the rowsourcetype as 2 and the rowsource as the cursor name. Using the combobox, when you scroll to a different client, the combobox "interactivechange" issues the command to requery the large listbox.
>
>in the requery of the listbox, it selects data from the tasks table for the clientnumber in the combobox and puts it into a cursor. The init of the listbox sets the rowsourcetype to 2 and rowsource to the cursor name.
>
>My Problem:
>I cannot figure out how to get the commandbutton to access the form in project_tasks, change the value of the combobox to the value of the client_number in project_client, and then populate the large task listbox with the correct tasks for that client.
>
>What I've Tried:
>I have tried a number of different ways, such as:
>in the command button, issue the following:
>
>do form_tasks
>form_tasks.combobox.value = thisform.client.value
>
>i get function,name, etc. is invalid
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Reply
Map
View

Click here to load this message in the networking platform