Duplicate a Record

sseawright

New member
Local time
Today, 15:02
Joined
Mar 9, 2005
Messages
7
I have a database with a table that uses a numeric field as a PK. If I use the built in "Duplicate" Command button on a form it creates an exact duplicate of the record, which then Access won't allow because the PK is no longer unique.

Does anyone know of a way that I could make the number be the max number + 1 when I click the "Duplicate" Button?

Thanks
 
Nevermind, I figured it out.

For anyone interested here is my code:

Scanned_Image = "There Are No Scans Linked to this Record"
NewLateralNumber = DMax("[Lateral_Number]", "tbl_Lateral_Location_Sheets") + 1
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
DoCmd.GoToRecord , , acLast
Lateral_Number = NewLateralNumber
 

Users who are viewing this thread

Back
Top Bottom