When you use your own code to generate a unique ID, then do it as the LAST instruction in the form's BeforeUpdate event. That way you at least have a shot at not burning a number if the user elects to not save the record. Also, depending on how busy your environment is, you always run the risk of generating a duplicate number if two people are in the process of saving at the same time. So, the first person who actually saves, "wins" and the other(s) "lose" and their insert is rejected due to a duplicate unique ID. You need to trap this error and either loop in the program code to generate a new number or force the user to press save again to go through the normal process of saving.
If you generate the unique ID in the BeforeInsert event - which is the earliest rational place to do it, your risk of having to burn a number increases dramatically. Another "never" is, you never want to dirty a record before the user does. This is the path to saving incomplete records unless your validation code in the form's Beforeupdate event is sound and ensures that all required data is present and valid.
We don't have a clue what business rule is driving this request so we can't make actual suggestions on how you might accomplish your goal. If you decide that it is more important that the user see the new ID before he even starts entering data, you would need to generate the ID in the form's Current event whenever the form moves to a "new" record. This is really bad design because at this point you don't know what your user's intention even is. Does he actually want to add a new record? I would never generate the ID in this event.