Is there a way to limit the number of purchases using a specific promo code?

I am looking to launch a pilot with a limited number of people and want to find out if there is a way I can use the promo code to help with this. Specifically, I want to allow 20 people to gain access to test the program. So when #21 tries, they get a page to let them know its closed but can sign up for the launch.