How to reset the ID back to 001 every year, the auto generated ID is 001-19 which 19 is the current year. Following is the code:
Dim idnumber As Integer
con.Open()
Dim command As SqlClient.SqlCommand = con.CreateCommand()
command.CommandText = "select MAX([CCLA File Number]) as id from tblLegalAidCaseFile"
objdatareader = command.ExecuteReader()
While objdatareader.Read
idnumber = Val(objdatareader.Item("id").ToString()) + 1
End While
Me.CCLA_File_NumberTextBox.Text = Format(idnumber, "000") + "-" + Format(Now, "yy")
Thank You