Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with the basics
Message
 
To
03/06/1998 21:46:40
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00104548
Message ID:
00104559
Views:
19
>First of all I don't have much of a programming background and I'm not too knowledgeable about parameters and scoping variables but understand it's pretty fundamental to programming, especially to Foxpro. I'm having a lot of trouble trying to figure it out on my own.
>
>I'm using VFP3b and have a form with three textboxes that accept input (section, township, range). A button click combines the three to make a string used to SEEK on a table. In the click is code that checks to see that all the fields are filled or gets them back to the textbox that's empty. The first time the form is used if all the fields get filled in there is no problem, but if one of the textboxes is empty and the previous button is clicked I get a variable not found error. If I make the variable public and assign it a " " value I don't get the error but I understand that exposes the variable to 'stomping' and is not quality programming.
>
>How do I make the variables local to the form?
>
>Thanks for any assistance.

Jim, I would suggest you:

1. Instead of local variables create and assign form properties.

2. If appropriate, create lookup tables for your section, township and range (or if they already exist somewhere just use those fields. IMHO (if possible) it is better to select existing (say, defined in the lookup tables) values from the listbox or combobox rather then input them in textboxes. (But really it depends on your app, also if the range is a date range you may enter it manually, or use any Calendar OCX control)

3. Instead of SEEK you may use SQL select to cursor, something like

SELECT * from myTable where myTable.section = thisform.lstSection.Value ;
and myTable.township = thisform.lstTownShip.Value and BETWEEN(myTable.range, range1,range2) INTO cursor _ctmp

You may also use parameterized view where parameters will be your selected (or entered) values from listboxes, comboboxes or textboxes.

HTH,

Nick
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform