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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

_screen.forms not working

Status
Not open for further replies.

MForrest

Programmer
Jun 9, 2003
85
0
0
GB
Hi all sorry to touch on this subject again but I am having problems getting this to work, have I missed something out?

My problem is my application has two main screens a diary and a client details screen, the two forms share some of the same tables within the data environment thus if the user was to open the diary form when the client form is open an error message appears saying there is a cyclic relationship. I was hoping to run this bit of code from the menu to close all current forms that may be open before opening the new form accessed from the menu.

* close all forms before opening the client details form else we will have a cyclic relationship between data of the forms

FOR EACH loForm IN _Screen.Forms
loForm.release
endfor

do form client

This code is not working, do I have to reference each form by name?? I have also tried the following:

FOR EACH loForm IN _Screen.Forms
do case
case lower(loForm.name) == "frmdiary"
loForm.release

case lower(loForm.name) == "frmappointments"
loForm.release

case lower(loForm.name) == "frmsearchclient"
loForm.release
endcase
endfor

do form client

If anyone has any ideas here I would appreciate the help
thanks
 
My problem is my application has two main screens a diary and a client details screen, the two forms share some of the same tables within the data environment thus if the user was to open the diary form when the client form is open an error message appears saying there is a cyclic relationship. I was hoping to run this bit of code from the menu to close all current forms that may be open before opening the new form accessed from the menu.

You shouldn't have to close all forms before opening another one. This would make it difficult in a multiuser environment. A cyclic relationship usually means a realtionship that is set wrong (Like setting a relationship on an index tag to the same index tag), you may want to address this issue as a separate problem.. Also are your forms set for private datasession? This would allow each forms to use its own set of data, and not pay attention to what another form has opened.



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi Mike thanks for your speedy response, I did not know about the DataSession property of a form, the joys of teaching yourself foxpro. I have set the datasession of both forms to private and it works a treat, no more cyclic relationship between the two forms, I have also set both forms to modal to encourage the user to close one form before accessing the other this way each form displays up to date information which is quite important with my diary screen form.

Thank you very much
 

Thank you very much

Glad you worked it out.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi mike, sorry to bother you again, have i delved into something here that I clearly dont know what I am doing. Running the menu and calling both forms with the private datasessions in the design environment works dandy but when I build into an executable and run i get some strange goings on occuring. When the form is processing data, such as querying or setting variables the data is displayed both to the main screen and the form(does this make sense Im not sure quite how to describe it) .Is there something else i must set when I am using a private data session as when I change the forms back to a default data session this does not occur.

Dazed and confused
 
When the form is processing data, such as querying or setting variables the data is displayed both to the main screen and the form(does this make sense Im not sure quite how to describe it) .

Private datasession means that each form has its own datasession including the fact that all the SETs you may have in your main program can (and have to) be reset in the load of the form. For example in the load you may need to put:
SET DELETED ON
SET TALK OFF
SET SAFETY OFF
SET DATE MDY etc.

In the VFP help file you will find information on each SET setting as to whether they need to be reset for private data sessions.

For example in the SET TALK (at the bottom) you'll find this:
SET TALK is scoped to the current data session.

This means that if you are in a private session, it needs to be reset.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Thank you again Mike, resetting the settings within the forms load method sure did the trick.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top