I'm developing a vb.net program that inserts records on a MSAccess table. The structure of the record is very simple: Field a1 is a counter Field b1 is a a numeric value As you know when I insert a record I do not have to specify the counter value (a1 field) because it is calculated automatically. Generally the next value is incrementebd by 1 but, if the last inserted record is deleted, the counter value is calculated by adding the last counter value +2. My program should show the counter value of the record before insert it in the table. How to calculate it ? Thank you very much for your help and cooperation regards
- 7My program should show the counter No, you shouldn't use those values for your UISteve– Steve2015-10-07 21:09:40 +00:00Commented Oct 7, 2015 at 21:09
- 1The auto increment ID is just a unique identifier. It is of no interest to the user at alluser3697824– user36978242015-10-07 22:48:57 +00:00Commented Oct 7, 2015 at 22:48
- 2"...if the last inserted record is deleted, the counter value is calculated by adding the last counter value +2". No it isn't. The system knows what the last generated value was and it increments that. Why exactly do you think you need to display this value before saving? There can be legitimate reasons but usually people who want to do that are simply misguided and haven't considered all the implications or alternatives.jmcilhinney– jmcilhinney2015-10-08 01:41:17 +00:00Commented Oct 8, 2015 at 1:41
- VB6 answer, but you should be able to adapt it. stackoverflow.com/questions/6498221/…jac– jac2015-10-08 02:59:16 +00:00Commented Oct 8, 2015 at 2:59
Add a comment |