Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SCATTER MEMVAR MEMO making me crazy
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
SCATTER MEMVAR MEMO making me crazy
Miscellaneous
Thread ID:
00514676
Message ID:
00514676
Views:
137
I have two forms with like fields and like fieldnames filling the each form. How come SCATTER MEMVAR MEMO is doing what it is doing?
For example:

My two tables look like this:
Table1
lastname Char 10 with a value of "SMITH"
firstname Char 10 with a value of "JOHN"

Table2
lastname Char 10 with a value of "BROWN"
firstname Char 10 with a value of "TOM"

Here's a coding sample demonstrating the problem:
Run Form1 coding sample:
DO Form1 with param1

Form1 Init coding sample:
SELECT table1
SCATTER MEMVAR MEMO
SELECT table2 (but only to plug a single value into a different field in form1)
do some stuff with the table2 value
SELECT table1
THISFORM.Refresh

Form1 has a lastname textbox and a firstname textbox with Control Source as m.lastname and m.firstname respectively.

So at this point I see Form1 showing:
Smith John in the texboxes

I don't need to do a GATHER at this point because I am not in add or edit mode on the record, just browsing.

Then I press a command button to go to Form2 coding sample:
RELEASE ALL (which is supposed to release the m.lastname and m.firstname memory variables? Maybe they don't release because they might be PUBLIC? I will check into that possibility)

THISFORM.Release (which releases Form1)
DO Form2 with param1

Form2 Init coding sample:
SELECT table2
SCATTER MEMVAR MEMO
SELECT table1 (but only to plug a single value into a different field in Form2)
do some stuff with the table1 value
SELECT table2
THISFORM.Refresh

Form2 has a lastname textbox and a firstname textbox with Control Source as m.lastname and m.firstname respectively.

So at this point I see:
Brown Tom on Form2 (but only for a split second)

Then I see:
Smith John on Form2 which somehow is carried over from Form1 and replaces what's showing on Form2.

It's as if I never RELEASEd the variables from Form1. How can this happen?
But since I never did a GATHER the records were not replaced with the wrong data and no data was damaged, corrupted or lost. But it's showing me the wrong record on the wrong form. The same thing happens in reverse if I start with Form2 and go to Form1. What I am doing wrong? Wouldn't SELECT table1, SCATTER MEMVAR MEMO, followed by SELECT table2, SCATTER MEMVAR MEMO, overwrite the memory variables from table1 with those from table2?

Note - I know about the SCATTER NAME command which would fix this problem, but I am not allowed to use it and I am limited to SCATTER MEMVAR MEMO commands on these two forms.

Thank you!
Steve Kramer
Kramer & Kramer Design
"Home of Go Cartoons"
Web Site: www.stephenkramer.com
Would you believe Far Side Lite?
More than 270 original cartoons.
Next
Reply
Map
View

Click here to load this message in the networking platform