Help to change data in a table

M

Mattias

Hi

I have a table with data I would like change with help from code running a
loop throw all the records and change.
There are about 3.000 records in the table.

The data I would like to change is in txt field called Field1.
I would like to create a new txt field Field2 (I create this manually in
design view), then I would like the code to delete some data and move some
data from Field1 to the new Field2.

All the records in Field1 have the same data structure: 1text, 2text
I would like to keep 1text in Field1 delete , and move the 2text (without
space in front of it) to the new Field2

Is it poosible to do this by code?

Thank you in advance..

Mattias
 
R

Rick Brandt

Mattias said:
Hi

I have a table with data I would like change with help from code running a
loop throw all the records and change.
There are about 3.000 records in the table.

The data I would like to change is in txt field called Field1.
I would like to create a new txt field Field2 (I create this manually in
design view), then I would like the code to delete some data and move some
data from Field1 to the new Field2.

All the records in Field1 have the same data structure: 1text, 2text
I would like to keep 1text in Field1 delete , and move the 2text (without
space in front of it) to the new Field2

Is it poosible to do this by code?

Why don't you just use an update query?

(untested)

UPDATE YourTableName
SET Field2 = Mid(Field1, InStr(1, Field1," ")+1),
Field1 = Left(Field1, InStr(1, Field1, ",")-1)
 

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

Similar Threads


Top