To accomplish something like inventory control, you will have to add a column in your database to list what the inventory left is.
On the cart page, you can have a show if region for the button and the message. Show the button if there is enough inventory, show the message if there is no inventory left. You will have to use a recordset to get the information on the product so that you can display this.
For the cart, you will also have to do the same thing. Check if the number added to the cart is greater than the inventory left and if it is then show an error message. If not, then show the checkout button.
Make sure that each time an item is sold, the database is updated to reflect the reduction in inventory.