A record is created in my table (TEST Data) when i hit the save button on my form.
The record is created, and the suppliers name as an example is "Phils Cables", now i want to automatically create a duplicate record in my table with the same information i just saved, the only difference being the new record will have a new Supplier name "Steves Cables".I've had a go solving the problem with the code below, but im stuck cause it don't seem to work.
So in summary, two records exactly the same, apart from the second record has a different supplier name, which will only be "Steves Cables" Anyone ?
***********************************
'Code to duplicate last saved record, but with different supplier name
Dim dbs As DAO.Database
Dim testdata As DAO.Recordset
Set dbs = CurrentDb
Set testdata = dbs.OpenRecordset("TEST Data")
With testdate
.AddNew
[Supplier] = "Steves Cables"
[Part No] = Me.PartNo
[Issue No] = Me.IssueNo
[Address] = me.address
[Phonenum] = me.phone
.Update
.Close
End With
The record is created, and the suppliers name as an example is "Phils Cables", now i want to automatically create a duplicate record in my table with the same information i just saved, the only difference being the new record will have a new Supplier name "Steves Cables".I've had a go solving the problem with the code below, but im stuck cause it don't seem to work.
So in summary, two records exactly the same, apart from the second record has a different supplier name, which will only be "Steves Cables" Anyone ?
***********************************
'Code to duplicate last saved record, but with different supplier name
Dim dbs As DAO.Database
Dim testdata As DAO.Recordset
Set dbs = CurrentDb
Set testdata = dbs.OpenRecordset("TEST Data")
With testdate
.AddNew
[Supplier] = "Steves Cables"
[Part No] = Me.PartNo
[Issue No] = Me.IssueNo
[Address] = me.address
[Phonenum] = me.phone
.Update
.Close
End With
Last edited: