Re: recno() and "Record is out of range"
- From: "Hii Sing Chung" <singchung@xxxxxxxxxxx>
- Date: Thu, 4 Dec 2008 22:41:41 +0800
Stefan,
Is it that by adding a surrogate key or a primary key I just keep the key in memory first, then no matter if the record pointer has moved elsewhere, I can move it back to its original record by reference the key in memory?
"Stefan Wuebbe" <stefan.wuebbe@xxxxxx> wrote in message news:%23zW%23wsSVJHA.3908@xxxxxxxxxxxxxxxxxxxxxxx
"Hii Sing Chung" <singchung@xxxxxxxxxxx> schrieb im Newsbeitrag news:1FC10069-534D-4FEB-ABC0-6FBC9D71729C@xxxxxxxxxxxxxxxxStefan,
Correct me if I am wrong, from the solution you provided, we are trying to locate the recdno, if EOF encountered, then goto the top or bottom.
Yes. The difference between "Go To 3" and "Locate Record 3" is
that the latter will not cause an error if there is no 3rd row in the result
anymore, in the first place.
That is the current strategy I used, but it still hasn't solved the problem of returning the record pointer to the original record we are working on. As I check for EOF, if true, goto bottom, the user will always see the last record after she keyed in a new record (or make modification of an existing record) and if I don't check EOF, it will give "Record is out of range" error.
How do I make sure it will return me to the position of original record (in this case the newly created record or just modified record)?
The problem may be that after requiring the row set, the former row
is not in the same position anymore, either because the queried table
was updated by another user, or because sequence may vary depending
on the new filter or an SQL Order By clause or Set Order To .
In that case, you may not want to use Recno() as a row identifier at all -
with any kind of SQL, it's a good idea to have a "surrogate primary-key"
column, say call it cust_id in a customers table and put some "meaningless"
unique values in there, for example a string like "025D53F4-5C29-C844-8E26-1EAEC7CD9C01" that you'd get from the CoCreateGUID() API.
hth
-Stefan
--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------
.
- Follow-Ups:
- Re: recno() and "Record is out of range"
- From: Stefan Wuebbe
- Re: recno() and "Record is out of range"
- References:
- recno() and "Record is out of range"
- From: Hii Sing Chung
- Re: recno() and "Record is out of range"
- From: Stefan Wuebbe
- Re: recno() and "Record is out of range"
- From: Hii Sing Chung
- Re: recno() and "Record is out of range"
- From: Stefan Wuebbe
- recno() and "Record is out of range"
- Prev by Date: Re: Filtering of combobox rowsource items based on the value selected on another combobox
- Next by Date: Re: Calculation of balance
- Previous by thread: Re: recno() and "Record is out of range"
- Next by thread: Re: recno() and "Record is out of range"
- Index(es):
Relevant Pages
|