MoveFirst, MoveLast strange behavior 
Author Message
 MoveFirst, MoveLast strange behavior

When using movelast to get access to the last record of a
table I get a record close to the last one but not always
the last one.

I already tried to change orderby filters, to modify the
values of the fields to see if there was any effect and
got no result at all.

As a temp solution I created a MyMoveLast function that
do provide the right record but I suspect to get
performance problems with this in the future.

Could anybody let me know if those problems have been
covered already and what the solution was ?

Thanks.



Sun, 05 Sep 2004 18:32:15 GMT  
 MoveFirst, MoveLast strange behavior
Hi Vincent,
The term 'last record' really has no meaning
until you define it. If you mean the last entry
made, you must have time stamp field, for example,
EntryDate, and then sort by that field.

When you pull records from a table, there is no
guaranteed order unless you specify one.

HTH
Dan Artuso, MVP

Quote:

> When using movelast to get access to the last record of a
> table I get a record close to the last one but not always
> the last one.

> I already tried to change orderby filters, to modify the
> values of the fields to see if there was any effect and
> got no result at all.

> As a temp solution I created a MyMoveLast function that
> do provide the right record but I suspect to get
> performance problems with this in the future.

> Could anybody let me know if those problems have been
> covered already and what the solution was ?

> Thanks.



Sun, 05 Sep 2004 19:52:04 GMT  
 MoveFirst, MoveLast strange behavior
Hi Dan.

Thanks for this reminder...
I need to be more detailed.

I inherited an old DB to migrate to Access 2000 from a
customer.

This customer _WANTS_ to keep its old numbering scheme
for the primary table they are using (and that's their
right). This numbering had gates in it (old records
deleted).

I created an autonumber primary key field in the new
Access table. I then created a field with the old numbers
of the customer. There is a univoque relationship between
the two. And then there are all the other data fields.

I then uploaded the data in Access at once.

To automatically create the old number for their new
records I need to access the last record and increment it.

I would expect the last record to be the one with the
higher number in the new autonumber primary key field.

The problem is that Access keeps taking the same record
(not the last one according to the definition I just
provided) even when I continue to enter new records in
the database afterwards. For test purpose I deleted this
record Access considers as the last one. Access then
takes the previous one, and so on if I delete this one...

I thus created a MyMoveLast that just open the recordset
and loop on movenext until the end of the recordset : I
then get the real Last Record !

For your info, I had a similar problem with MoveFirst
when wanting to upload all the data with a module not
displaying anything on a form : Access always started
with the 22nd record : why ? Obscure for me.

It worked perfectly fine when I finally used a dedicated
form coupled with the source table : from the first to
the last in the right order...

Still a mystery to me...



Mon, 06 Sep 2004 17:47:20 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Recoedset performance with movefirst, movelast

2. Problem with MoveFirst and MoveLast methods of RDO 2.0

3. Problem with MoveFirst and MoveLast methods of RDO 2.0

4. MoveFirst, MovePrevious, MoveNext, MoveLast Error...

5. MoveFirst / MoveLast Error

6. Strange Subform Record Behavior

7. word mail merge strange behavior

8. Strange behavior with INT function

9. strange behavior

10. Strange behavior in Add-Ins

11. Strange Behavior

12. Strange Behavior with queries in code

 

 
Powered by phpBB® Forum Software