Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Scan!!
Message
From
29/05/1997 16:06:47
Matt Mc Donnell
Mc Donnell Software Consulting
Boston, Massachusetts, United States
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Re: Scan!!
Miscellaneous
Thread ID:
00034138
Message ID:
00034163
Views:
37
>>>>>I am using scan command everytime the form load up, so it calculate every single record. (I want to make sure whatever client enter is being calculate)
>>>>>scan
>>>>> **calculation
>>>>>endscan
>>>>>
>>>>>I want to know is there any other faster command can get the job done faster. Now, everytime client load the form it take 1 minute or so to open up and that's with 16 meg of ram. I can't imagine if the client have less than 16meg of ram, it probably take a while to load.
>>>>
>>>>why do you want to SCAN at load up time?
>>>
>>>I scan the data so it make sure what ever client enter had correctly calculate. I did it at the destroy event also.
>>>Unless I could find a way to do the calculation once the user finish entering data in one textbox, but I look through all the event it doesn't allow you to do so. I could use the keypress event, so that the user have to press tab or whatever evertime they finish enter the data and do the calculation there.
>>
>>
>>That's kinda what I thought. I'm assuming your table is in a database. Use a trigger to recalculate your fields when a record is added or edited.
>>
>>HTH
>
>Hi Matt, what you mean by using trigger??
>what if I just want to calculate the value the user had just enter into the textbox, is there any event or method within the textbox that could tell me the user had finish entering data with that textbox, then do the calculation??
>Other than using keypress event (user don't like to press extra key everytime after they finish entering data to see the result on the screen)

Sam,

I see two options:

1. At the data level, you can use a stored procedure to recaculate the necessary fields whenever a record is added or deleted. If you're already using referential integrity rules, you will need to call this proceudure from within the procedures that VFP created for you. (look up trigger in your help file for more info. Or, like Ed always says, open your Dev Ref. ;-) )

2. At the form level, you can add code to your valid on the textbox to see if the calculation is needed. In your GotFocus or When event, record the current .value (.tag is good place). In your valid, see if .value changed, then call your function and return a .f., otherwise return a .t.. The only keypress the user needs is a return. If the calculation looks ok, hit return again without changing anything and off the user goes to the next field.

I believe either of these will help.
Matt McDonnell
...building a better mousetrap with moldy cheese...
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform