I have a form called PowerlineF. It's tied to a MS SQL backend table called PowerlineT. On this form I have a button "btnDuplicateProject". The goal is to duplicate the current record when a project needs to be split in half due to a decision to build it in different phases with different construction timelines. The code I planned to use to duplicate is:
Private Sub Duplicate Project_Click()
On Error GoTo err_Error_handler
If Me.Dirty = True Then
Me.Dirty = False
On Error Resume Next
Set objOutlook = Nothing
Set objMailItem = Nothing
Select Case Err.Number
MsgBox "Canceled by user.", vbInformation
MsgBox "Error " & Err.Number & " " & Err.Description
I have some unique indexes preventing the duplicated record from saving. My unique column is "ProjectName". How can we prompt the user to provide a new name for the ProjectName field when pasting the duplicate record?
Also, if original project was named "Silvertip Powerline" and we wanted to split that project in half, we would need to change the original ProjectName to "Silvertip Powerline (Phase-1)" and the new duplicated project as "Silvertip Powerline (Phase-2)" at the time of duplication? I'm thinking we'd deploy a message box to facilitate the name change by asking the what the ProjectName should be changed to on the original, then followed by another message box prompting user to provide a ProjectName for the duplicate/new. Problem is, I don't know how to implement these things within the code.