Access 2007 - Copying Records Within The Same Table
I have 2,433 records in a table (with many many fields).
I need to make an exact copy of each record, with one exception. I need a change made in each newly created record which will give it a unqiue name. These records present various funding scenarios for various companys. Essentially this table holds the results of "what if" games played by accountants.
Each of the existing 2,433 records now have a "scenario" name of "Original Scenario" (the field is even called Scenario) - all of the remaining fields have number representing a variety of things.
I need to make a copy of all 2,433 records but with a scenario name of "New Scenario". Everything would be indentical except that one field. The end result would be that I now have 4,866 records with 2,433 having "Original Scenario" in the Scenario field and 2, 433 records with "New Scenario" in the Scenario field. This is what I've tried, but all it does is duplicate everything, even the scenario name.
Code:
Public Sub m_AddNewScenarioRecords()
'the purpose of this sub is to insert a fresh set of records
'for a newly created scenario. this scenario is created and
'saved on the PCMH_Data form
Dim db As DAO.Database
Set db = Access.Application.CurrentDb
Dim rsOriginal As DAO.Recordset, rsNew As DAO.Recordset
Dim i As Long
Set rsOriginal = CurrentDb.OpenRecordset("SELECT * FROM source_scenarios_results WHERE scenario = 'Original Scenario' ")
Set rsNew = CurrentDb.OpenRecordset("SELECT * FROM source_scenarios_results WHERE scenario = 'Original Scenario' ")
Do While Not rsOriginal.EOF
With rsNew
.AddNew
For i = 0 To .Fields.count - 1
If .Fields(i).Value = "Scenario" Then 'insert new scenario name in scenario field
.Fields("Scenerio") = "New Scenario"
Else 'otherwise insert existing value into new field
.Fields(i).Value = rsOriginal.Fields(i).Value
End If
Next
.Update
End With
rsOriginal.MoveNext
Loop
End Sub
What am I doing wrong?