Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Memvar comes and goes on pageframe
Message
From
03/10/2002 13:35:05
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00707351
Message ID:
00707426
Views:
22
>I have a form with a pageframe with two pages.
>In the load portion of the form, I run some queries to load the main record from a sql database, along with several over small queries for lookup data for combolist. In the load portion of the form, I determine if the user is doing a new record or updating an existing one. I then select the primary record cursor (schcase), and scatter memvar for edit mode or scatter memvar blank for new mode. On both pages, the data controls are bound to the m.memvar whatever the field name is. It works great on a new record for both pages. When I'm in the edit mode, the first page is great, but page two's controls have no data. I put a button on page two and put:
>
>wait [Field Value=]+transform(m.PrimaryCarrierID) window
>
>If I click on the button, I get an error message saying m.PrimaryCarrierID is not defined. But it was. If I put some data into the fields first and then push my button, it shows the data fine. I also copied the button to the first page and I still received the error unless I first put in data.
>
>I display the same wait command right after the scatter in the show and it is there. I used the debugger and put a watch on m.PrimaryCarrierID and it changed after my scatter with the value, then it disappeared on the page1 activate, and when I clicked on page2 (where the value should appear) it changed again to a blank value.
>
>Any clues?

Using memvars for controlsources is unreliable, in the least. Since you already have your code around the scatter/gather logic, there's a simple way out: use scatter/gather NAME.

Add a property to your form, or pageframe (if it's a class of yours), name it oRecord and set its value to .null.; then change your code to Scatter/Gather [Memo] Name thisform.oRecord, and set your controlsources to Thisform.oRecord.PrimaryCarrierID etc. I assume you're already setting the controlsources programmatically, so just replace the "m." with "Thisform.oRecord.".

Beware - in the beginning, Thisform.oRecord will have no properties until the first Scatter, so you should set your controlsources only after that. But then, the same goes for the memvars - they also have to exist beforehand.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform