Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Seek inconsistency
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Seek inconsistency
Miscellaneous
Thread ID:
01449027
Message ID:
01449027
Views:
134
I have seen the following problem inconsistently at our sites over the past few years but have now
been able to replicate it, but I dont understand why it is happening.

Scenario as follows:
I have a grid and a command button on a page
The Grid shows mostlty records from a Transaction file (TRAN)
One of the rows in the grid is: Iif(seek(Cusac,'CUSMF','CUSTAG'),CUSMF.CusName,' ')
(This just shows a Customer Name on a Grid using a lookup to a Customer Master File)

On the button click event , I have something like:
Sele Tran
Scan
....
&& AAAA
Seek Tran.Cusac
If not eof()
Do stuff on the CUSMF
Endif
Sele Tran
Endscan

Now most times, this works fine.
When there are lots of Transation records, say 100 or more, the wrong CUSMF record is seeked (In AAAA)
If there are say 900 records, the wrong CUSMF record could be processed wrongly 4 times
If I run the same code again, wrong records are processed, but different wrong records

The 'ACTUAL' record that is incorrectly 'Seeked' turns out to be the Last record that is visible on the Grid
This is always the case.
What appears to be happening, randomly, is that in the middle of the Scan Loop (which is on the Click event of a Button)
Foxpro is going back to the screen somwhow, running the IIF on the grid, landing on a different record and then processing
thsi record on the CUSMF instead of the SEEKED record. I think the SEEK is actually working but in the middle of the loop
the IIF is also kicking in and landing on the wrong record.

As far as I can tell, I dont have any code that refreshes, or sets focus back to the form, I dont have any set realtions on either

Now that I have been able to replicate this, it expalins about 4 other intances in Forms where data has been updating the wrong account, on other tables

I have been able to code around it by either making the Grid Invisible (just prior to calling the code) or taking the IIF out of the Grid

Would anybody have an explanation for this type of behaviour ?
TIA,
Gerard
Next
Reply
Map
View

Click here to load this message in the networking platform