copy data from 1 table to another

  • Thread starter Thread starter Daniel M
  • Start date Start date
D

Daniel M

I have a form that pull in data from one table that i want to put into
another table when a submit button is pressed.

IE: i run a qry that pulls in customer name, i then fill out the rest of the
form and click submit. all the data should then be written to another table
including customer name.

How would i go about this?

thanks.
 
I have a form that pull in data from one table that i want to put into
another table when a submit button is pressed.

IE: i run a qry that pulls in customer name, i then fill out the rest of the
form and click submit. all the data should then be written to another table
including customer name.

How would i go about this?

thanks.

More to the point: SHOULD you do this?

You can do it using an Append query, but in general, it is Bad Design
to store the same data redundantly in two tables. It's very easy for
the data in the two tables to get out of synch; if you then have a
customer who's named "John Smith" in one table, and "Joan Smith" in
another, how can you tell which is right?

Please explain why you feel that you need to do this.

John W. Vinson[MVP]
 
Because in this situation 1 table is a linked file (DTS) output from our
database and one is a linked Excel file that we use independently of access.
We are just using the DTS as a lookup table. So Customer Jon smith may be in
the excel file 100 times for different reasons. It's temporarily being used
as a call tracking system until we can migrate everything into our main
database.
 
I have a form that pull in data from one table that i want to put into
another table when a submit button is pressed.

IE: i run a qry that pulls in customer name, i then fill out the rest of the
form and click submit. all the data should then be written to another table
including customer name.

How would i go about this?

thanks.

Ok, simply create an Append query. Since I have no idea what "all the
data" might be or where it's coming from I can't specifically suggest
the structure of this query, but you can combine fields from a Table
and literal references to a Form Control:

INSERT INTO Table2 (field, field, field, field, field ...)
SELECT LastName, FirstName, CustomerID, Forms!yourform!txtThis,
Forms!yourform!txtThat, ...
FROM sourcetable
WHERE <criteria>

John W. Vinson[MVP]
 
Back
Top