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

saving record location

Status
Not open for further replies.

fishman13

Programmer
Jul 8, 2002
73
0
0
US
I have a form that displays records based on an account number. I start by using a select into cursor to get a list of only the account number of interest and sorting it by date. I have arrows keys that will scroll through the records and display the fields in text boxes. When a new record is created I write the record back to the origional data table and do a requeery. When I modify a record I use the same logic, which causes the problem. When doing an edit I want the record that was just modified to still be displayed. However the requey appears to lose my record number.
 
You can save the record location by using RECNO().

location = RECNO()
*** requery
GOTO location

Jim
 
Jim,

I had that logic in there and it never jumped to the current location.
 
fishman13

Bear with me because I am a bit dense sometimes, so I am not sure if I am following you correctly.

But if I am understanding you correctly, the query must be putting the child records into some type of control. For example, a listbox. Assuming that is correct. You would need to tell the pointer of the control to move back to its original position after doing a requery.

A listbox, again as an example, would be something lik this.

1. First capture the current listitem number and save it as a property on the form. IE listItemNumber

2. After the requery, reset the listitem to its original state.

Thisform.list1.SelectedID(thisform.listItemNumber) = .T.


I have not tested this code, but I think the concept is correct, if I am following you okay.

Jim Osieczonek
Delta Business Group, LLC
 
If you're using a grid, perhaps it's just a refresh issue?

&& Code &&
location = RECNO()
*** requery
GOTO location
thisform.grid1.refresh
thisform.grid1.setfocus
&& End Code &&

That said, can the requery change your reccount() or ORDER? Maybe you want to identify you location based off of some actual data and then LOCATE FOR?

A listbox is a whole other matter...

Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top