Hi all,
I have a table with an “autonumber” primary key field that also acts as
a foreign key in 2 other tables. I would like to programmatically add a
new record to the first table and the other 2 child tables. The reason
for doing this is to copy one complete record (parent and child table
records) into a new record so the user can make a few modifications.
So how do I determine what will be the next auto-generated number for my
primary key? I visualize doing this schematically like:
1. Open a Transaction
2. Get the next autonumber value
3. Add a new record to my first table (have Access generate the primary key)
4. Add a new record to my 2 child tables using the “next autonumber
value” as the foreign keys
5. End Transaction
I have always resisted using auto-numbered primary keys in this type of
instance for this very reason. But in this situation I almost had to.
This database was an “observation database” and it’s a bit difficult to
ask people to manually keep track of how many observations they take.
Thanks,
Phillip J. Allen
e-mail: pa*****@attglobal.net