am connecting VB with access ..
i have a trainees form , when i click on New it should gives me the new ID automatically by adding one to the last ID ... now .. what am using is this code:
//////////////////////
rsTrainee.MoveLast
intID = rsTrainee.Fields("trainee_id"
.Value
rsTrainee.AddNew
Me.txtTraineeID.Text = intID + 1
////////////////////
the problems is that access sorts the IDs Ascending in this way:
1
10
11
12
2
3
4
5
6
7
8
9
..
so the last value will be 9 not 12 !! and the new id will be 10 not 13 ... so what can i do in this case??
i have a trainees form , when i click on New it should gives me the new ID automatically by adding one to the last ID ... now .. what am using is this code:
//////////////////////
rsTrainee.MoveLast
intID = rsTrainee.Fields("trainee_id"
rsTrainee.AddNew
Me.txtTraineeID.Text = intID + 1
////////////////////
the problems is that access sorts the IDs Ascending in this way:
1
10
11
12
2
3
4
5
6
7
8
9
..
so the last value will be 9 not 12 !! and the new id will be 10 not 13 ... so what can i do in this case??