Hi All,
I have a form with a duplicate record button to allow records to be copied. I used this code (I think from Allen Browne), but it only copies the last record in the recordset? Any ideas? Thanks
If Me.Dirty Then 'Save any changes
Me.Dirty = False
End If
If Me.NewRecord Then 'Check there is a record.
MsgBox "Select a record to duplicate"
Else
With Me.RecordsetClone 'Point the clone set to this record.
.Bookmark = Me.Bookmark
'Go to a new record, and copy from the clone set.
RunCommand acCmdRecordsGoToNew
Me!CompanyName = !CompanyName
Me!AddressLine1 = !AddressLine1
Me!AddressLine2 = !AddressLine2
Me!AddressLine3 = !AddressLine3
Me!AddressLine4 = !AddressLine4
Me!AddressLine5 = !AddressLine5
Me!ContactName = !ContactName
Me!ContactTitle = !ContactTitle
Me!PhoneLand = !PhoneLand
Me!PhoneMobile = !PhoneMobile
Me!ContactEmail = !ContactEmail
End With
End If
I have a form with a duplicate record button to allow records to be copied. I used this code (I think from Allen Browne), but it only copies the last record in the recordset? Any ideas? Thanks
If Me.Dirty Then 'Save any changes
Me.Dirty = False
End If
If Me.NewRecord Then 'Check there is a record.
MsgBox "Select a record to duplicate"
Else
With Me.RecordsetClone 'Point the clone set to this record.
.Bookmark = Me.Bookmark
'Go to a new record, and copy from the clone set.
RunCommand acCmdRecordsGoToNew
Me!CompanyName = !CompanyName
Me!AddressLine1 = !AddressLine1
Me!AddressLine2 = !AddressLine2
Me!AddressLine3 = !AddressLine3
Me!AddressLine4 = !AddressLine4
Me!AddressLine5 = !AddressLine5
Me!ContactName = !ContactName
Me!ContactTitle = !ContactTitle
Me!PhoneLand = !PhoneLand
Me!PhoneMobile = !PhoneMobile
Me!ContactEmail = !ContactEmail
End With
End If
Last edited: