Sure you could, but it sounds like (maybe?) you are trying to emulate the way that an IDENTITY (or in Access, an AUTONUMBER) field works. If so, you should use that feature of the database to avoid duplicate data. If not, simply create a random ID as a value (perhaps in a HIDDEN field) when you generate the form.
The problem is that if you use simply a random number, you run the risk of having a duplicate number assigned to a user at some point. It is not a good idea. Use an AUTONUMBER field in Access to accomplish this.