Append / Update to same table

M

Mark S

I need to duplicate a record in the same table and change the data in one
field. Field name is EquipID. An example of the data would be
"Machine-1/2", needs all records that meet that criteria to be duplicated to
"Machine-1" and "Machine-2".

The plan is to append a set of records with the new EquipID of "Machine-2"
and then go back and update "Machine-1/2" to "Machine-1".

I saw in a previous post where somebody modified a numeric field with "X:
[YourField] * -1", but I am having trouble adapting that.

Thanks for any suggestions.
 
N

Noëlla Gabriël

Hi Mark,

you could try to make a query as follows:

INSERT INTO tblTest ( EquipID )
SELECT "Machine-1" AS fldMach1
FROM tblTest
WHERE tblTest.EquipID="Machine-1/2";

run the query and the change the "Machine-1" into "Machine-2" and run it a
second time.
 
M

Mark S

Thanks for the help. That's basically what I got to eventually. My mistake
was when I tried to include the other fields I also include an Autonumber/key
field. Leaving that out, it gets filled automatically anyway.

Noëlla Gabriël said:
Hi Mark,

you could try to make a query as follows:

INSERT INTO tblTest ( EquipID )
SELECT "Machine-1" AS fldMach1
FROM tblTest
WHERE tblTest.EquipID="Machine-1/2";

run the query and the change the "Machine-1" into "Machine-2" and run it a
second time.

--
Kind regards
Noëlla


Mark S said:
I need to duplicate a record in the same table and change the data in one
field. Field name is EquipID. An example of the data would be
"Machine-1/2", needs all records that meet that criteria to be duplicated to
"Machine-1" and "Machine-2".

The plan is to append a set of records with the new EquipID of "Machine-2"
and then go back and update "Machine-1/2" to "Machine-1".

I saw in a previous post where somebody modified a numeric field with "X:
[YourField] * -1", but I am having trouble adapting that.

Thanks for any suggestions.
 
F

Flavio Argueta

I don't understand what fldMach1 represents. Is this a made up field to have the output listed? I've tried it and i get a type conversion failure and key violations, lock violations and validation rule violations.

My purpose is the same, to append new records to the same table updating the Semester field on the appended records to "Fall 2009". The original records have a Semester entry of "Spring 2008" Any assistance would be appreciated.



N wrote:

RE: Append / Update to same table
29-Sep-08

Hi Mark

you could try to make a query as follows

INSERT INTO tblTest ( EquipID
SELECT "Machine-1" AS fldMach
FROM tblTes
WHERE tblTest.EquipID="Machine-1/2"

run the query and the change the

Previous Posts In This Thread:

Append / Update to same table
I need to duplicate a record in the same table and change the data in on
field. Field name is EquipID. An example of the data would b
"Machine-1/2", needs all records that meet that criteria to be

RE: Append / Update to same table
Hi Mark

you could try to make a query as follows

INSERT INTO tblTest ( EquipID
SELECT "Machine-1" AS fldMach
FROM tblTes
WHERE tblTest.EquipID="Machine-1/2"

run the query and the change the

Thanks for the help. That's basically what I got to eventually.
Thanks for the help. That's basically what I got to eventually. My mistak
was when I tried to include the other fields I also include an Autonumber/ke
field. Leaving that out, it gets filled auto

EggHeadCafe - Software Developer Portal of Choice
Uploading & Downloading Files using ASP.NET
http://www.eggheadcafe.com/tutorial...cd-7cc6fc1980a4/uploading--downloading-f.aspx
 

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