By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,078 Members | 1,280 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,078 IT Pros & Developers. It's quick & easy.

Copy one column to another???

P: n/a
This is driving me crazy!! I'm using MSACCESS, and all I want to do is
create a macro/query/anything that will take the data in Column A and
copy it into Column B (same table)

"Insert into" ALMOST works ... unfortunately it adds the data at the
END of Column B ... and I need Column B to be an exact replica of
Column A (but with a different name of course).

Right now I have my users doing it manually, but I really want to
automate it so they don't have to do ANYTHING (i.e. so they don't
break anything).

I've even tried various SendKeys actions ... but there simply isn't
any "select column" command, so I either select a single field, or I
select all the records in the table.

I'm at wit's end ... help??
Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Melissa, Design a query and make it an Update Query. To do that select
Query / Update Query from the main menu while in query design. Add the
field that you want to update to the query grid. In the Update To row set
it to the name of the field in your table that you want it to update from.
If you had Field2 and wanted to update it to Field1 put [Field1] in the
Update to row under Field2. Run the query. Everything in Field1 will be
copied over to Field2 of the same record.

--
Reggie

----------
"Melissa Kay Beeline" <me***************@hotmail.com> wrote in message
news:83**************************@posting.google.c om...
This is driving me crazy!! I'm using MSACCESS, and all I want to do is
create a macro/query/anything that will take the data in Column A and
copy it into Column B (same table)

"Insert into" ALMOST works ... unfortunately it adds the data at the
END of Column B ... and I need Column B to be an exact replica of
Column A (but with a different name of course).

Right now I have my users doing it manually, but I really want to
automate it so they don't have to do ANYTHING (i.e. so they don't
break anything).

I've even tried various SendKeys actions ... but there simply isn't
any "select column" command, so I either select a single field, or I
select all the records in the table.

I'm at wit's end ... help??

Nov 13 '05 #2

P: n/a
You need to build what is called a update query (update is a good
name..eh?).

Depending on your skill level, you can either execute this query in code, or
simply use the query builder.
the sql to do this looks like:
update tableCustomers set Fieldb = fielda

The above can be written as one line of code.

For learning, and getting a feel for the above idea...try ding the above
with the query builder.

from the query tab in the database, you can go:

new->design view->

now, drop in your table.

then go

query->update query

now, in the first column of the grid..simply select fieldb

in the field update to, simply put fiielda..

You can now whack the run button (!).

However, this is DANGEROUS..so MAKE sure you do a back, or test/play on a
copy lest you make a mess here.....

This is a hot knife through butter..and these update sql commands are
powerful....

Good luck..and if you need help on how to do the above in code, or with a
button on a form...feel free to expand on your question...
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
http://www.attcanada.net/~kallal.msn
Nov 13 '05 #3

P: n/a
me***************@hotmail.com (Melissa Kay Beeline) wrote:
This is driving me crazy!! I'm using MSACCESS, and all I want to do is
create a macro/query/anything that will take the data in Column A and
copy it into Column B (same table)


I'm curious as to why you would want to do this. Will you be subsequently
changing the copied values?
Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.