Click to See Complete Forum and Search --> : unique student number ADODC


ill-fated24
January 22nd, 2010, 06:33 AM
good day everyone!
newbie in dbms abd vb here.,

i am having trouble automating student
number.,
i use this code to automate a unique student number.,

Dim uh As Integer

uh = Data1.Recordset.RecordCount

If uh = 0 Or uh < 10 Then

MaskEdBox2.Text = "2009-000" & uh

ElseIf uh = 10 And uh < 100 Then

MaskEdBox2.Text = "2009-00" & uh

ElseIf uh = 100 And uh < 1000 Then

MaskEdBox2.Text = "2009-0" & uh

ElseIf uh > 1000 And uh < 10000 Then

MaskEdBox2.Text = "2009-" & uh

Else

MaskEdBox2.Text = "2009-"

End If

now it does it job correctly..
but when i try to delete a record.,
lets say i have added records with student numbers from :
2009-0000,2009-0001,2009-0002,2009-0003,2009-0004

when i try to delete lets say 2009-0002
and tried to add another record the code brings the student number 2009-0004.,which should not because im trying to create a unique student number,.
the next studnumber should be 2009-0005.,

any help and explanation,.i'll be very thankful.,

thanks..

ill-fated24
January 22nd, 2010, 07:32 AM
sorry..
my mistake with the title..
its a data control..