hi, i have a code being created for lecturers using the initials of lecturer names inputted. for example john smith = JS, i have also added a variable called codenumber which i have used to add a number to the initials. JS1, as more than one lecturer may have the same initials. I do not know how i can check if JS1 already exists in my table as its a primary key of the lecturer table. so in vba what code do i need to place in an IF statement to check the code that is about to be produced does not exist or if it does it adds 1 to the codenumber variable making it JS2 for instance.