Thank you for your reply alansidman.
I suppose that this code localize the current record you are and then copy all the data to a new one. right?
Hello everyone, I have found another way to perform this:
Code:
Private Sub cmd_copyrecord_Click()
Dim currentID As Long
'TO DO: change all instances of 'BookID' with the actual name of your table's ID or primary key
If IsNull(BookID) Then
MsgBox prompt:="Please select the record to copy first.", buttons:=vbExclamation
Exit Sub
End If
currentID = BookID
DoCmd.GoToRecord record:=acNewRec
'TO DO: set the fields to be copied (those that most likely will have the same values)
'FORMAT: fieldName = Dlookup("fieldname", "tableName", "primaryKeyField=" & currentID)
Author = DLookup("Author", "Books", "BookID=" & currentID)
Country = DLookup("Country", "Books", "BookID=" & currentID)
Language = DLookup("Language", "Books", "BookID=" & currentID)
Genre = DLookup("Genre", "Books", "BookID=" & currentID)
Publisher = DLookup("Publisher", "Books", "BookID=" & currentID)
Title.SetFocus 'TO DO: change 'Title' with name of field that is going to be edited by the user
End Sub
this is the link where I found the information: https://www.datanumen.com/blogs/quic...ecords-access/
Thank you all.