GK in the UK
Registered User.
- Local time
- Today, 23:20
- Joined
- Dec 20, 2017
- Messages
- 281
Can I re-use the PK for a record in a local table before a c & r is performed?
Lots of questions and answers on variations of this question but they seem to be focussed on inserting records into an AutoNumber sequence which isn't what I want.
I know that we don't normally use the PK for user-visible app functionality. In this scenario, I simply want a list of record ID numbers for some process to be performed. It occurred to me that I can simply insert a record into the local 'selections' table using the same PK as the main table. So it's a one-column table with a 1 to 1 relationship.
User may check a selection (insert record using PK eg 123), uncheck the selection (delete record 123), re-check same record (Access attempts to insert record using PK 123). User doesn't know or care that it's record 123 it will just ease my coding plus since the PK is always indexed it seems like an efficient way to do it. Obviously the PK for the selections table wouldn't be AutoNumber it would be what I code it to be (PK of main table)
I don't want to write a tag to the main table, 2 users could be viewing an overlapping sub set of records and want their own unique selection list.
Lots of questions and answers on variations of this question but they seem to be focussed on inserting records into an AutoNumber sequence which isn't what I want.
I know that we don't normally use the PK for user-visible app functionality. In this scenario, I simply want a list of record ID numbers for some process to be performed. It occurred to me that I can simply insert a record into the local 'selections' table using the same PK as the main table. So it's a one-column table with a 1 to 1 relationship.
User may check a selection (insert record using PK eg 123), uncheck the selection (delete record 123), re-check same record (Access attempts to insert record using PK 123). User doesn't know or care that it's record 123 it will just ease my coding plus since the PK is always indexed it seems like an efficient way to do it. Obviously the PK for the selections table wouldn't be AutoNumber it would be what I code it to be (PK of main table)
I don't want to write a tag to the main table, 2 users could be viewing an overlapping sub set of records and want their own unique selection list.