You might be OK if you enforce the record to be saved first, then write the generated number to the table whereupon it will display in the control. I agree with pbaldy that to create the number first and put it into the table some time after is not advisable. You would open the form and ensure the generate button is disabled, then enable it after the record saving has taken place.
Edit:
as an afterthought, you might want to review information regarding form design with effective placement of controls in mind. Having an action button that comes after a close or cancel button in the visual path is not an example of good design. This page might be of some help http://uxmovement.com/buttons/why-ok...-on-the-right/
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.