Home > Archive > MS Access database support > February 2006 > Separate one field into two fields









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Separate one field into two fields
Tony

2006-02-17, 11:24 am

Hi,

I have an ID text field that is composed of two alphabetical letters
and the rest are numbers. This field is also a primary key. In this
same table, I want to separate this field into two fields. Then make
these two new fields primary keys. The first just contains the two
alphabetical letters. The second contains the numerical digits. Is
there a way to do this without losing current data?

Thanks,

Tony

fredg

2006-02-17, 1:24 pm

On 17 Feb 2006 09:08:07 -0800, Tony wrote:

> Hi,
>
> I have an ID text field that is composed of two alphabetical letters
> and the rest are numbers. This field is also a primary key. In this
> same table, I want to separate this field into two fields. Then make
> these two new fields primary keys. The first just contains the two
> alphabetical letters. The second contains the numerical digits. Is
> there a way to do this without losing current data?
>
> Thanks,
>
> Tony


Add 2 new fields to your table, [LetterPortion] and [NumberPortion] as
Text datatypes.

You can run an update query after you added the two new fields to the
table.

Update YourTable Set YourTable.LetterPortion = Left([TextField]),2),
YourTable.NumberPortion = Mid([TextField],3);

Change the field names however you want.

Both the letter and number portions are still Text datatype and you
still have your original ID field.

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com