How ccan append last entry form one table to another????
Access append query...
Collapse
X
-
Create an append query. If you are trying to copy the record from Table1 to Table2, the SQL will look something like this:Originally posted by SakakiniHow ccan append last entry form one table to another????
Then if you want to delete the record from Table1 after copying it to Table2, create a delete query, which would like something like this:Code:INSERT INTO Table2 SELECT Table1.* FROM Table1 WHERE ((([Forms]![Formname]![Fieldname])=[Table1]![Fieldname]));
Code:DELETE Table1.* FROM Table1 WHERE ((([Forms]![Formname]![Fieldname])=[Table1]![Fieldname]));
-
Originally posted by tdwCreate an append query. If you are trying to copy the record from Table1 to Table2, the SQL will look something like this:
Then if you want to delete the record from Table1 after copying it to Table2, create a delete query, which would like something like this:Code:INSERT INTO Table2 SELECT Table1.* FROM Table1 WHERE ((([Forms]![Formname]![Fieldname])=[Table1]![Fieldname]));
Code:DELETE Table1.* FROM Table1 WHERE ((([Forms]![Formname]![Fieldname])=[Table1]![Fieldname]));
I tried what you have suggested and it create a new col. in the query. Maybe I was not clear in my quest for an answer to my question. Let me try again:
I have two tables, Table1 and Table2. Table1 has 5 fields out of which 2 fields I want to copy from table2. Here is my delima. when I enter new record into tablel I need to pick the 2 new fileds and append table1 by insurting these two fileds in a new record in table1.
Awaiting your advice....
Thanks,Comment
-
Yes, that is a little different than I was thinking. Unfortunately I don't quite understand exactly what you are trying to do. Maybe the answer to the following questions will help:Originally posted by SakakiniI tried what you have suggested and it create a new col. in the query. Maybe I was not clear in my quest for an answer to my question. Let me try again:
I have two tables, Table1 and Table2. Table1 has 5 fields out of which 2 fields I want to copy from table2. Here is my delima. when I enter new record into tablel I need to pick the 2 new fileds and append table1 by insurting these two fileds in a new record in table1.
Awaiting your advice....
Thanks,
1. Are you entering data from a form, and what table is the form's control source?
2. How are you entering data into the other table? What is it's purpose?
Go ahead and give me specific table and field names so we can avoid using confusing nicknames for your fields.Comment
-
If I'm understanding this correctly, it appears that you want to update certain fields in a table instead of adding a series of records to a table. If so, you must run an "Update" query. Here is a generic SQL statement illustrating this.Originally posted by SakakiniI tried what you have suggested and it create a new col. in the query. Maybe I was not clear in my quest for an answer to my question. Let me try again:
I have two tables, Table1 and Table2. Table1 has 5 fields out of which 2 fields I want to copy from table2. Here is my delima. when I enter new record into tablel I need to pick the 2 new fileds and append table1 by insurting these two fileds in a new record in table1.
Awaiting your advice....
Thanks,
UPDATE Table1
INNER JOIN Table2
ON Table1.[JOIN KEY] = Table2.[JOIN KEY]
SET
Table1.[FIELD 4] = [Table2]![FIELD 1],
Table1.[FIELD 5] = [Table2]![FIELD 2];
Hope this helps...Comment
Comment