Duplicating records

caferacer

Registered User.
Local time
Today, 15:28
Joined
Oct 11, 2012
Messages
96
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
 
Last edited:
How about saying what you want duplicated? One record? First record? More records? Any record?
 
Yeah, fair point.

Its just one record, the current record.

THanks
 

Users who are viewing this thread

Back
Top Bottom