Hi,
Let me say first of all that I am completely new to this forum and also not a desperately experienced in ASP and VBScript programmer.
My problem is the generation of a truly unique ID for a record in an access DB (please don't start telling me to use a 'real' database - that's what I've got and that's what I have to use!). Yes, I know there are loads of discussions out there on this topic but none of them are completely satisfactory.
Here are my thoughts as I understand things and the problems with them:
The simplest approach is to use an autonumber - fine this gives a unique ID, but my problem is that I need to copy these records from one db to another (identical structure) and they MUST retain the same ID after the copy. This is not an option with autonumber.
Next we have max approach as in:
Now I can go ot to use the newPackID in a new record. I have seen this proposed many times in discussions throughout the web and indeed used in some of our own legacy code and quite frankly I'm horrified. Maybe I'm misunderstanding it, but it seems to be that the internet is pretty much the biggest multiuser environment in the world and sooner or later two users will access the database at approximately the same time both getting the same maximum value before the other has the chance to save their new record. Result - two (or more if we are really busy) records with identical IDs.
I have considered using a random number and keep generating a new one until we get one that doesn't yet exist. Not as horrendous as it might seem if (a) we are not doing this too often and (b) the table in question is not too big. Unfortunately whilst I could go down this route successfully it is really going to be much more convenient to the user if the generated IDs are (more or less) sequential - which pushes me back towards the autonumber arghhhh.
Can anyone out there help? pretty please!
Mike