After you get the ID of the Order Form from the "Add Screen" and if it's not zero, you go to it and refresh the screen.
Main Topics
Browse All TopicsI have created an order entry program in VFP9. When you open the first form that is the "main" form to view orders, it is set to automatically go to the first order that is closest to the current date. It does this correctly. There is a button for adding an order. When you clik on that button it opens a different form to add a new order. When completed and an enter button is clicked, the add screen disappears and the original main form remains. I need the main form to now jump to the order that was just entered.
Thanks
Dean
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Passing a value back requires you to call the form modally which is the easiest solution if that is OK. If you do not want to do that you can have the add form deactivate and raise an event instead of closing. You can then have the original form handle that event by finding the orderid from the decativated form, jump itself to that order then relesae the deactivated form.
See Event Binding for Visual FoxPro Objects in the help file.
I'm not sure if this will help exlain the problem: I created a public variable in the first, main form. When ready to exit the add form and add the new order, I set the value of the newest order's ID to that public variable, I issue a thisform.release for the add form, I issue a "Set order to" command to get the original orderids ascending, and then finally i issue a Locate for orginal orderid = public variable.
Through my very limited debugging capabilites, i have found that when the add form exits, the public variable does contain the correct value, but I just can't seem to get the main form to refresh and go to the orderid that equals the public variable. I've tried putting the thisform.refresh in different places but it still doesn't work. I must be missing something that is keeping the main form from refreshing when the add form releases. Any suggestions?
Here is the probable culprit - tell me if I have the sequence of events correct.
Public variable declared
add button click does this
calls Add form (which populates the global variable before releasing)
sets order and locate for id = the public variable
If your add form is not called modally then the code after it in the click snippet keeps executing so your locate has already finished before the Add form has has a chance to set the global variable to another value. you need to stop code execution of the click by making the add form modal or add an event to the add form that you raise before releasing ti and bind that event to a handler in the main form that does the locate work. You could also put a loop inside the click that keep asking if the add form is still alive and does not continue until it is gone but that is really a real kludge.
Business Accounts
Answer for Membership
by: CarlWarnerPosted on 2008-01-20 at 20:12:00ID: 20703838
How to: Return a Value from a Form /en-us/lib rary/ fdsh1 7sy(VS.80) .aspx
http://msdn2.microsoft.com
DO FORM FindCustID TO cCustID