>If I use a PK table I will then have gaps in my IDs. I don't want any, is there a way to know what the next ID is or use flags on the records for inprocess and reusable and take the IDs depending on these flags or by adding a new ID?
>
>Tyler
I see where you're getting at, but I don't think it can be done. Consider this scenario: you have 2 users who are adding a record each at about the same time.
User 1 presses "Add" - which fetches the next ID. That ID is, say, 5.
User 2 also presses "Add". Which ID should he fetch? 5 or 6? We don't know if User 1 will ever save it's record, or if he will cancel. So either you get a gap, or you wait for the record to be written to know the ID.
I'm curious, though: why do you need to know the ID before you save it? I'm not saying there aren't valid reasons, but there might be another way around.
Sylvain Demers