**I have a problem in the Trainee Id

Iwant the ID to be like that 20120001

the year should be change if we are in new year and start with a new count

i alrady connect the vb with a database

how can i do that?
**

If there are no records in the current year then set the ID to year*10000 + 1 otherwise set it to MAX(TraineeID)+1

In ur insert query u can use the following to get the date....

Date.Today.Year.ToString

and then concatenate the remaining value to the string

else u can one create a integer variable and set the integer variable to

Dim abc as Integer
abc = Date.Today.Year.ToString * 10000 + 1

in ur insert query use the abc variable and the next time u want to use it increment the same by 1....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.