I have a query that finds certain data based upon what I want it to. It looks up info in tblEntrants, looking for category=2, gender=M, and racenumber is null. Basically I am trying to see if a RaceNumber exists. If it doesn't, assign the person(s) the next highest number between a start and stop number. Here is my code so far:
This works perfect to get the names of the males in category 2 without a race number. I also have looked up the males in category 2 with race numbers. The male racenumbers are between 51-450. So far, 51-117 have been named and there are like 76 that havent. How can I assign racenumbers to the males that don't have one, based upon looking up the already existing numbers?Code:SELECT tblEntrants.Category, tblEntrants.Gender, tblEntrants.LastName, tblEntrants.RaceNumber FROM tblEntrants WHERE (((tblEntrants.Category)=2) AND ((tblEntrants.Gender)="M") AND ((tblEntrants.RaceNumber) Is Null)) ORDER BY tblEntrants.LastName;




Reply With Quote