The recordset query looks ok to me, you would of course need to ensure that the posted element you list is the element with the quantity that the user enters. This way you will check on the available quantity minus the quantity that the user is trying to add.