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

FoxPro Grid

Status
Not open for further replies.

bus1st

Programmer
Jun 5, 2001
3
US
I have a grid with two columns. The Record Source is a table that has two indexes to reference the data in the first and second columns. I put code in the header click events to change the order and refresh the grid. The problem is that I loose the record reference when I change the order between columns.

The code in each header click event is:
set order to index in table
thisform.grid.refresh()
thisform.grid.column.text.setfocus

If I am on record n in the first column when I click the header in the second column I do not maintain the same record number after I resort the second column.

 
Please clarify:

"If I am on record n in the first column...."

If you're on record n in the 1st column aren't you also on record n in the 2nd column? Unless your table is opened multiple times the record pointer can only be pointing to 1 record at a time.

Jim
 
Hi,
1. At the Form level create a variable called nRecord with 0 (Zero) as initial value.
2. In the AfterRowColChange event of the grid put the code,
ThisForm.nRecord = RECNO()
3. In the click event of the header add the following code at the end ..
Go ThisForm.nRecord

This will solve your problem ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
LET KNOW IF THIS HELPED. ENOUGH EXPERTS ARE HERE TO HELP YOU OUT! BEST OF LUCK :)
 
Preliminary test seems to work. Will let you know when I incorporate in my production code and test extensivly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top