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!

Simple Scope Problem on Form

Status
Not open for further replies.

crewchiefpro5

Programmer
Dec 17, 2004
33
0
0
US
I have a pageframe form that uses memory variables for recordsource. I am losing focus on a few memory variables and I cannot see where it is happening, even in the debug mode. They seem to disappear when the form is done with INIT.

I know this is simple, however, I am missing something.

The variable is called M.WEIGHT and is a lookup from another dbf. As soon as the lookup is done the variable goes out of scope. I have a bunch of these type of variables but only this one is a problem.
 
tho not a good approach, you could declare that varible to PUBLIC before doing anyhting with it.

instead of using PUBLIC, why not create another form property that will store the lookup value. open your form, go to "form" menu, click "new property" and type the name of the new property - say "mylookup" click "add" and save the form. open the form property window and scroll down. at the end you'll see the new added "mylookup" property having an initial value of .F. but you can change its value later on in your program. you can then reference that property like
Code:
thisform.mylookup = "ANYTHING"
messagebox(thisform.mylookup)

hope this helps. peace! [peace]

kilroy [trooper]
philippines

"If the automobile had followed the same development cycle as the computer, a Rolls-Royce would today cost $100, get one million miles to the gallon, and explode once a year, killing everyone inside."
 
I was going to add a property to the form, but my concern is that the other variables did not need this, why this one?

Weight should not be a reserved word, it is not private anywhere in the code. I have it stop on debug on m.weight and it stops each time. Right when the form displays it is gone.

I will keep pounding away.

 
Perhaps one of your tables has a field named "weight"?

Jim
 
Any varaible defined in init will go out of scope when init finishes unless declared public.

Regards,

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top