How can I combine data in two separate fields in a table?

M

Matt Meserve

I have one Access table which contains 2 fields. I want to combine the data
in each of these fields into a single field. There must be an easy way to
do this but I have no idea. Can someone please help.

To be specific, I have linked a .txt file to an Access database. This .txt
file is comma dilimited and contains phone numbers in which the area code is
separate from the actual phone number. When the data is linked and/or
imported into an Access table, Access obviously puts the area code into
Field1 and the rest of the phone number into Field2. What I'm trying to do
is combine the area codes and phone numbers so that they only occupy a
single field in Access.

Thanks for any help!
 
A

Alejandra Parra

FieldPhoneNumber = Field1 + ' ' + Field2
if you want a white space between them
if not...
FieldPhoneNumber = Field1 + Field2
 
M

Matt Meserve

Alejandra - Thanks for the suggestion. However, when I create a new query
and enter this expression I'm prompted for a FieldPhoneNumber Parameter
value when I try to run the query.

After typing the expression into the query it looks like this.

Expr1: [FieldPhoneNumber]=[Field1]+[Field2]

Thoughts?

Thanks!
Matt
 
F

fredg

FieldPhoneNumber = Field1 + ' ' + Field2
if you want a white space between them
if not...
FieldPhoneNumber = Field1 + Field2

A permanent change?
What does the current data look like?
Like this?
Area Code PhoneField
212 369-9865

Back up your data first.

Create an Update query.
Update YourTable Set YourTable.PhoneField = YourTable.AreaCodeField &
" " & PhoneField Where YourTable.AreaCodeField Is Not Null;

This will change the PhoneField to include the area code.
212 369-9865

Delete the Area Code field afterwards if you wish.
 
M

Matt Meserve

Thanks folks. I think I've got it now. For some reason when I remove the
"FieldPhoneNumber=" part of the expresson and just have "Field1+Field2" it
works fine.

Oh well.

Thanks!!!

Matt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top