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

go to the next record

Status
Not open for further replies.

lesina

Programmer
Apr 10, 2001
76
ES
Hi everyone

i'm making a vb6 programm and i'm having a problem.
Here it goes:
my programm reads from an acess database, i get it's data using a data(vb control) and with it, i can delete, change, look for, whatever record.
Well, one of the tables has an id for primary key and the problem is here.
when i create a new record, this id is automatic and it's bigger than the last(so that i have no repeated records id).
Some of the times, i have unordered id's because i insert and delete records and change others.
So, at this point i have id's ordered this way:
21
22
43
44
45
48
8
6
27
49
50
and my problem is that i have a cicle and i use .recordset.movenext to change from one record to the next.
But the anormal is going from record id=48 to the one with id=49 and letting records between without belonging to the cicle.
What's happening?
Can anyone help me?

Thanks in advance, ===================
* Marta Oliveira *
===================
marta100@aeiou.pt
-------------------
CPC_TA- Braga
-------------------
Portugal
===================
 
Although you may see the id's in the order you have posted, if this field is the primary key then in the underlying table the records will be ordered by this field. This means that the next record after 48 is actually 49. The other records will be nearer the beginning of the recordset. Have fun! :eek:)

Alex Middleton
 
Autonumber fields aren't a very good source for a sort order for the reason that you mention. Is there any type of DATE field that you can use? Terry
**************************
* General Disclaimor - Please read *
**************************
Please make sure your post is in the CORRECT forum, has a descriptive title, gives as much detail to the problem as possible, and has examples of expected results. This will enable me and others to help you faster...
 
I agree with Terry. I use create my own numbers that can be used as identifiers - much more reliable. Have fun! :eek:)

Alex Middleton
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top