View Full Version : Append in table 2 for each record in table 1


brickelldb
05-28-2009, 07:20 AM
Kind of stumped on this. Searching "append for each" just kind of throws me into standard quering articles. Any help would be greatly appreciated.

Table 1_Customer: ID, First, Last (2 records)
Table 2_Transaction: ID, CustomerID, Date, Amount

What I'm trying to do is create an append query that will insert a record into Table 2 for each record in Table 1.

Ex: My form has 2 fields: Date, Amount.

I want the append query to append 2 records into Table 2. 1 record for the 1st record of Table 1 and 1 record for the 2nd record of Table 1. But obviously would like for it to do it for EACH record in Table 1, regardless of how many records in Table 1. And where the ID from the record in Table 1 is in inserted in the CustomerID field of Table 2.

pbaldy
05-28-2009, 07:54 AM
Create a SELECT query that returns the records from table 1, then turn it into an append query. It will ask you for the target table, and you may have to adjust the destination fields if they're not the same.

brickelldb
05-28-2009, 08:30 AM
Interesting. I did not think about that. Let me give that a shot. Thanks for the response.

marlan
07-18-2010, 12:06 AM
Create a SELECT query that returns the records from table 1, then turn it into an append query. It will ask you for the target table, and you may have to adjust the destination fields if they're not the same.

I would say it is better you casted the data from the source tables, useing Cstr(), Clng() etc. functions. Use the Expression Builder and the help offered there.

vbaInet
07-18-2010, 04:54 AM
I would say it is better you casted the data from the source tables, useing Cstr(), Clng() etc. functions. Use the Expression Builder and the help offered there.But how would CStr() and CLng() handle null values?