Automatically create records with same primary key field

G

Guest

I have two tables that have the same primary key field (one-to-one
relationship). When I add a record to one table, I'd like a new record
automatically created in the related table (this record would initially be
blank with the exception of the primary key field). What is the simplest way
to do this? (without special prgramming, if possible).
Example: One table is "Project Info", the other table is "Financial". They
are related through the "JobNumber" primary key field. When I add a new Job
Number (that is, a new record) to the Project Info table, I'd like a new
record with the same Job Number automatically created in the Financial Table.
I cannot combine the two tables into one because they have different
security levels.
Thank you.
 
A

Arvin Meyer [MVP]

You cannot do it at the table level. You must use a form.

If you don't want to make a subform for the second table you can write a
little procedure which will append a record into the second table. Something
like:

Sub Form_AfterInsert()
CurrentDB.Execute "INSERT INTO Table1 ( ID ) SELECT " & Me.txtID
End Sub
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top