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

Merging columns in a table

P: 8
Hi,

I hope somebody can help me?

I've got a macro that pulls data from an Excel sheet into a table. Everything works okay but I need some way of merging the data in two columns together so that I can use the data in the new column to create a relationship with another table.

For example

Column A Column B
932 12345678

Needs to be

Column C
93212345678

What's the best way of doing this?

Thanks in advance!
Jan 16 '07 #1
Share this Question
Share on Google+
4 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
Hi,

I hope somebody can help me?

I've got a macro that pulls data from an Excel sheet into a table. Everything works okay but I need some way of merging the data in two columns together so that I can use the data in the new column to create a relationship with another table.

For example

Column A Column B
932 12345678

Needs to be

Column C
93212345678

What's the best way of doing this?

Thanks in advance!
Create column C in the table then run an update query

Expand|Select|Wrap|Line Numbers
  1. UPDATE TableName SET [Column C]=[Column A] & [Column B];
This syntax will only work properly if both A and B are text fields.

Mary
Jan 16 '07 #2

NeoPa
Expert Mod 15k+
P: 31,186
If you have access to the Excel file you could also create a column in there that reflects both columns concatenated.
Let me know if you're interested as the instructions are a little more complicated. Also, if interested, let me know if you will do it as an operator or in VBA (within Excel - only do this if you're reasonably strong in Excel VBA though).
Jan 16 '07 #3

P: 8
Thanks for you replies guys.

NeoPa - I don't really have access to the Excel file as a new file will be sent to us on a monthly basis from one of our customers.

mmcacarthy - Thanks for your answer. I will give it a go.

Thanks!
Jan 17 '07 #4

NeoPa
Expert Mod 15k+
P: 31,186
It's nice that you reply to all ideas - even those you don't plan to progress :)
I too felt MMcCarthy's idea the more likely but posting other ideas can sometimes help others who look into the thread later by Googling or such.
Jan 17 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.