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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

grid displays phantom records

Status
Not open for further replies.

ashmac2

Programmer
Mar 3, 2003
11
US
I have a grid displaying a cursor for timesheet entry. I have command buttons for duplicating a record or making a new entry so that I have more control over what the user does. I also display the time totals on the screen so the command buttons allow a snapshot of time values before and after changes. Whenever the record pointer may be moved, I grab the recno() and make sure to return to it, then refresh or setfocus. Somehow when I am updating fields in code from another table and the record pointer is not moving on the cursor, I return to the cursor and setfocus to the grid and duplicate records appear in the screen. I have SET STEP ON to see what is happening and if I browse the cursor there are actually extra records that I cannot click on and the the record/record count in the status bar show less total records than I can see. For example, I have 5 records, yet the display has 7, in browse I can see 7 but I can only click on 5 of the records. Any ideas?

 
How is this cursor being created/controlled?
1. How are the cursor records being initially created or added?
2. Are you perhaps using a FILTER on a more comprehensive cursor to view only those records of concern?

Using SET STEP ON is a good way to determine what is going on.

While tracking your code execution in your TRACE window once the SET STEP ON has executed, can you see where/when these 'extra' records are added to the cursor?

If not, you might want to see if you can move the SET STEP ON higher up in the code so that you can watch the APPEND BLANK command (or whatever you are using) occur.

Good Luck,
JRB-Bldr
 
This is definitely weird. I don't remember ever seeing this behaviour before.

One way to track down the problem would be to start the grid again from scratch. Gradually add features one at a time, until the problem comes back.

If the problem is related to the fact that you are updating another table, this technique ought to be able to confirm that.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Check for Lockscreen in your code

Cetin Basoz
MS Foxpro MVP, MCP
 
Does the table being displayed happen to be part of a relation formed by a set relation to command?

Alan
 
The cursor is created by CREATE CURSOR and then populated from a table with just the records that the employee has for the week already. Lockscreen is used no where. No relations are set.
I did SET STEP ON and watched the code. As soon as a phantom record appeared I browsed the file. The records were there but the status bar indicated I only 5 and 7 were displayed. I could not click on or delete or in any way access the records. I have never seen anything like it.
It was an older screen and I no longer use grids except for display as Mike has suggested before. I rewrote the thing today to update a record at a time and just use the grid for viewing everything.
I just hate for this thing to defeat me at something and was hoping someone had experienced it before.

 
"As soon as a phantom record appeared I browsed the file. The records were there but the status bar indicated I only 5 and 7 were displayed."

You are off to a good start in finding out what is going on.

Go to the location in the code again where the 'phantom' record first appears.

Then go to the Command window and do a COPY TO (somewhere) so that you can examine the records outside of the Form. I am trying to discern if the problem is in how/what the Form is displaying or what the cursor contents REALLY are.

Also, is the 'phantom' record totally unique from the other records or is it a duplicate of a REAL record.

I have seen situations where workstation memory issues can cause application displays like VFP to get 'goofy'.

Now, close your application and open the 'COPY TO' table and review the records to see how many records are there and if they are all for the single intended employee.

If all looks like it should, then we are looking at a display problem within the Form.

Tell us your results and we'll see where that leads us next.

Good Luck,
JRB-Bldr

 
that happened to me once and the culprit was corrupted index.

Ali Koumaiha
TeknoSoft Inc.
Michigan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top