A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Insert contents of Col in one table into another table



 
 
Thread Tools Display Modes
  #1  
Old May 28th, 2004, 01:36 AM
Sandy
external usenet poster
 
Posts: n/a
Default Insert contents of Col in one table into another table

Hello:

Is it possible in Access to insert the contents of a column from one table into another table? When I run a Sql statement, it pretends to be inserting (or doing something - hourglass) and when I view the table, nothing has been done.

This is my SQL statement:

Insert into table1
(col2)
Select ColA from table2;

What am I doing wrong?

Any help you can give me will save me lots of grief!!

Sandy
  #2  
Old May 28th, 2004, 04:35 AM
John Vinson
external usenet poster
 
Posts: n/a
Default Insert contents of Col in one table into another table

On Thu, 27 May 2004 17:36:01 -0700, "Sandy"
wrote:

Hello:

Is it possible in Access to insert the contents of a column from one table into another table? When I run a Sql statement, it pretends to be inserting (or doing something - hourglass) and when I view the table, nothing has been done.

This is my SQL statement:

Insert into table1
(col2)
Select ColA from table2;

What am I doing wrong?

Any help you can give me will save me lots of grief!!

Sandy


An INSERT query creates *new records* in the target table. In this
case, if Table2 had 2000 records, the query would create 2000 new
records in Table1 - unless Table1 has required fields other than Col2.

If you want to put the value in ColA into the field Col2 in *existing*
records in Table1, you will need instead to use an UPDATE query,
joining the two tables on a unique field so that it is unambiguous
what record you're updating.

It appears that you may be using "spreadsheet logic" here - a sure and
certain way to get into trouble! What are these tables, and how are
they related? What actual data are you trying to transfer?

John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public
  #3  
Old May 28th, 2004, 09:31 PM
Sandy
external usenet poster
 
Posts: n/a
Default Insert contents of Col in one table into another table

Hello, John -

You are right - I was using "spreadsheet logic" - don't ask me why.

Thanks for pointing that out.

Sandy
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:03 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.