Data Copying

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can i automatically copy a feild from one table and copy it into a
second, related table. Both feilds are primary keys.

eg. I use a form to input a value into the...customer_Code field in the
customer table, and as soon as i enter the data, i need it to auotmatically
place the same data inot the customer_Code field in the Agent Table.
 
PC nerd,

You could run an Append Query to add a new record to the Agents table
with the same customer_Code. For example, code like this on the After
Update event of the customer_Code control on your Customer form...

CurrentDb.Execute "INSERT INTO Agents ( customer_Code )" & _
" VALUES ('" & Me.customer_Code & "')",
dbFailOnError
' (assumes customer_Code is text data type)

It seems very strange that the same customer_Code is a primary key field
in both tables. Are you sure?
 

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

Back
Top