Error Message when Duplicating Record

mklitwin

Registered User.
Local time
Yesterday, 20:04
Joined
Sep 29, 2010
Messages
30
So i've built a simple database (that was working pretty well until i moved the file to a network drive so other employees could work with it - i think this COULD be the problem).

In any case, i have a form that pulls its data from a few tables/queries and updates this "master table". I have made a button on my form via the wizard to "duplicate records" however i keep getting the following erro message:

Run-time error '-2147352567 (80020009)':
Update or CancelUpdate without AddNew or Edit

I've included my code to see if anyone can help (alot of it is very simple "greying out" of items") but the items that get highlighted when i click "debug" are

Code:
Me.Entity_Code = Me.Entity_Name.Column(0)


Code:
Option Compare Database
'grey out entire form based on active/inactive
Private Sub Active_Inactive_AfterUpdate()
Me.Income_Allocation_Notes.Enabled = Me.Active_Inactive
Me.Current_Year_End_Complete.Enabled = Me.Active_Inactive
Me.Record_ID.Enabled = Me.Active_Inactive
Me.Date.Enabled = Me.Active_Inactive
Me.Entity_Code.Enabled = Me.Active_Inactive
Me.Entity_Name.Enabled = Me.Active_Inactive
Me.Address.Enabled = Me.Active_Inactive
Me.Location_Books_Kept.Enabled = Me.Active_Inactive
Me.Contact_Information.Enabled = Me.Active_Inactive
Me.US_Tax_Reporting_Type.Enabled = Me.Active_Inactive
Me.Inclusion_Type.Enabled = Me.Active_Inactive
Me.Stat_Year_End.Enabled = Me.Active_Inactive
Me.FS_Type_1.Enabled = Me.Active_Inactive
Me.Service_Provider_1.Enabled = Me.Active_Inactive
Me.Stat_Date_1.Enabled = Me.Active_Inactive
Me.FS_Type_2.Enabled = Me.Active_Inactive
Me.Service_Provider_2.Enabled = Me.Active_Inactive
Me.Stat_Date_2.Enabled = Me.Active_Inactive
Me.Tax_Reporting_Type.Enabled = Me.Active_Inactive
Me.Service_Provider_3.Enabled = Me.Active_Inactive
Me.Stat_Date_3.Enabled = Me.Active_Inactive
Me.Stat_Audit_Yes_No.Enabled = Me.Active_Inactive
Me.Income_Allocation_Yes_No.Enabled = Me.Active_Inactive
Me.Parent_1_Code.Enabled = Me.Active_Inactive
Me.Parent_1_Name.Enabled = Me.Active_Inactive
Me.P1___Owned.Enabled = Me.Active_Inactive
Me.P1_Stock_Class.Enabled = Me.Active_Inactive
Me.P1_Tracking_Interests.Enabled = Me.Active_Inactive
Me.Parent_2_Code.Enabled = Me.Active_Inactive
Me.Parent_2_Name.Enabled = Me.Active_Inactive
Me.P2___Owned.Enabled = Me.Active_Inactive
Me.P2_Stock_Class.Enabled = Me.Active_Inactive
Me.P2_Tracking_Interests.Enabled = Me.Active_Inactive
Me.Parent_3_Code.Enabled = Me.Active_Inactive
Me.Parent_3_Name.Enabled = Me.Active_Inactive
Me.P3___Owned.Enabled = Me.Active_Inactive
Me.P3_Stock_Class.Enabled = Me.Active_Inactive
Me.P3_Tracking_Interests.Enabled = Me.Active_Inactive
Me.Parent_4_Code.Enabled = Me.Active_Inactive
Me.Parent_4_Name.Enabled = Me.Active_Inactive
Me.P4___Owned.Enabled = Me.Active_Inactive
Me.P4_Stock_Class.Enabled = Me.Active_Inactive
Me.P4_Tracking_Interests.Enabled = Me.Active_Inactive
Me.Parent_5_Code.Enabled = Me.Active_Inactive
Me.Parent_5_Name.Enabled = Me.Active_Inactive
Me.P5___Owned.Enabled = Me.Active_Inactive
Me.P5_Stock_Class.Enabled = Me.Active_Inactive
Me.P5_Tracking_Interests.Enabled = Me.Active_Inactive
Me.Parent_6_Code.Enabled = Me.Active_Inactive
Me.Parent_6_Name.Enabled = Me.Active_Inactive
Me.P6___Owned.Enabled = Me.Active_Inactive
Me.P6_Stock_Class.Enabled = Me.Active_Inactive
Me.P6_Tracking_Interests.Enabled = Me.Active_Inactive
Me.Parent_7_Code.Enabled = Me.Active_Inactive
Me.Parent_7_Name.Enabled = Me.Active_Inactive
Me.P7___Owned.Enabled = Me.Active_Inactive
Me.P7_Stock_Class.Enabled = Me.Active_Inactive
Me.P7_Tracking_Interests.Enabled = Me.Active_Inactive
Me.Parent_8_Code.Enabled = Me.Active_Inactive
Me.Parent_8_Name.Enabled = Me.Active_Inactive
Me.P8___Owned.Enabled = Me.Active_Inactive
Me.P8_Stock_Class.Enabled = Me.Active_Inactive
Me.P8_Tracking_Interests.Enabled = Me.Active_Inactive
Me.Parent_9_Code.Enabled = Me.Active_Inactive
Me.Parent_9_Name.Enabled = Me.Active_Inactive
Me.P9___Owned.Enabled = Me.Active_Inactive
Me.P9_Stock_Class.Enabled = Me.Active_Inactive
Me.P9_Tracking_Interests.Enabled = Me.Active_Inactive
Me.Last_Edited_By.Enabled = Me.Active_Inactive
Me.Last_Edited_Date.Enabled = Me.Active_Inactive
Me.Reviewed_By.Enabled = Me.Active_Inactive
Me.Last_Reviewed_Date.Enabled = Me.Active_Inactive
End Sub
 
'grey out income allocation section and stat section
Private Sub Form_Current()
Me.Income_Allocation_Notes.Enabled = Me.Income_Allocation_Yes_No
Me.Stat_Year_End.Enabled = Me.Stat_Audit_Yes_No
Me.FS_Type_1.Enabled = Me.Stat_Audit_Yes_No
Me.Service_Provider_1.Enabled = Me.Stat_Audit_Yes_No
Me.Stat_Date_1.Enabled = Me.Stat_Audit_Yes_No
Me.FS_Type_2.Enabled = Me.Stat_Audit_Yes_No
Me.Service_Provider_2.Enabled = Me.Stat_Audit_Yes_No
Me.Stat_Date_2.Enabled = Me.Stat_Audit_Yes_No
Me.Tax_Reporting_Type.Enabled = Me.Stat_Audit_Yes_No
Me.Service_Provider_3.Enabled = Me.Stat_Audit_Yes_No
Me.Stat_Date_3.Enabled = Me.Stat_Audit_Yes_No
'grey out whole form for active/inactive
Me.Current_Year_End_Complete.Enabled = Me.Active_Inactive
Me.Record_ID.Enabled = Me.Active_Inactive
Me.Date.Enabled = Me.Active_Inactive
Me.Entity_Code.Enabled = Me.Active_Inactive
Me.Entity_Name.Enabled = Me.Active_Inactive
Me.Address.Enabled = Me.Active_Inactive
Me.Location_Books_Kept.Enabled = Me.Active_Inactive
Me.Contact_Information.Enabled = Me.Active_Inactive
Me.US_Tax_Reporting_Type.Enabled = Me.Active_Inactive
Me.Inclusion_Type.Enabled = Me.Active_Inactive
 
Me.Stat_Audit_Yes_No.Enabled = Me.Active_Inactive
Me.Income_Allocation_Yes_No.Enabled = Me.Active_Inactive
Me.Parent_1_Code.Enabled = Me.Active_Inactive
Me.Parent_1_Name.Enabled = Me.Active_Inactive
Me.P1___Owned.Enabled = Me.Active_Inactive
Me.P1_Stock_Class.Enabled = Me.Active_Inactive
Me.P1_Tracking_Interests.Enabled = Me.Active_Inactive
Me.Parent_2_Code.Enabled = Me.Active_Inactive
Me.Parent_2_Name.Enabled = Me.Active_Inactive
Me.P2___Owned.Enabled = Me.Active_Inactive
Me.P2_Stock_Class.Enabled = Me.Active_Inactive
Me.P2_Tracking_Interests.Enabled = Me.Active_Inactive
Me.Parent_3_Code.Enabled = Me.Active_Inactive
Me.Parent_3_Name.Enabled = Me.Active_Inactive
Me.P3___Owned.Enabled = Me.Active_Inactive
Me.P3_Stock_Class.Enabled = Me.Active_Inactive
Me.P3_Tracking_Interests.Enabled = Me.Active_Inactive
Me.Parent_4_Code.Enabled = Me.Active_Inactive
Me.Parent_4_Name.Enabled = Me.Active_Inactive
Me.P4___Owned.Enabled = Me.Active_Inactive
Me.P4_Stock_Class.Enabled = Me.Active_Inactive
Me.P4_Tracking_Interests.Enabled = Me.Active_Inactive
Me.Parent_5_Code.Enabled = Me.Active_Inactive
Me.Parent_5_Name.Enabled = Me.Active_Inactive
Me.P5___Owned.Enabled = Me.Active_Inactive
Me.P5_Stock_Class.Enabled = Me.Active_Inactive
Me.P5_Tracking_Interests.Enabled = Me.Active_Inactive
Me.Parent_6_Code.Enabled = Me.Active_Inactive
Me.Parent_6_Name.Enabled = Me.Active_Inactive
Me.P6___Owned.Enabled = Me.Active_Inactive
Me.P6_Stock_Class.Enabled = Me.Active_Inactive
Me.P6_Tracking_Interests.Enabled = Me.Active_Inactive
Me.Parent_7_Code.Enabled = Me.Active_Inactive
Me.Parent_7_Name.Enabled = Me.Active_Inactive
Me.P7___Owned.Enabled = Me.Active_Inactive
Me.P7_Stock_Class.Enabled = Me.Active_Inactive
Me.P7_Tracking_Interests.Enabled = Me.Active_Inactive
Me.Parent_8_Code.Enabled = Me.Active_Inactive
Me.Parent_8_Name.Enabled = Me.Active_Inactive
Me.P8___Owned.Enabled = Me.Active_Inactive
Me.P8_Stock_Class.Enabled = Me.Active_Inactive
Me.P8_Tracking_Interests.Enabled = Me.Active_Inactive
Me.Parent_9_Code.Enabled = Me.Active_Inactive
Me.Parent_9_Name.Enabled = Me.Active_Inactive
Me.P9___Owned.Enabled = Me.Active_Inactive
Me.P9_Stock_Class.Enabled = Me.Active_Inactive
Me.P9_Tracking_Interests.Enabled = Me.Active_Inactive
Me.Last_Edited_By.Enabled = Me.Active_Inactive
Me.Last_Edited_Date.Enabled = Me.Active_Inactive
Me.Reviewed_By.Enabled = Me.Active_Inactive
Me.Last_Reviewed_Date.Enabled = Me.Active_Inactive
End Sub
'grey out income allocation section button code
Private Sub Income_Allocation_Yes_No_AfterUpdate()
Me.Income_Allocation_Notes.Enabled = Me.Income_Allocation_Yes_No
End Sub
 
' auto populate entity 1 code based on name
Private Sub Entity_Name_AfterUpdate()
Me.Entity_Code = Me.Entity_Name.Column(0)
End Sub
'Auto populate entity 1 name based on code
Private Sub Parent_1_Code_AfterUpdate()
Me.Parent_1_Name = Me.Parent_1_Code.Column(1)
End Sub
' auto populate entity 1 code based on name
Private Sub Parent_1_Name_AfterUpdate()
Me.Parent_1_Code = Me.Parent_1_Name.Column(0)
End Sub
'Auto populate entity 2 name
Private Sub Parent_2_Code_AfterUpdate()
Me.Parent_2_Name = Me.Parent_2_Code.Column(1)
End Sub
' auto populate entity 2 code based on name
Private Sub Parent_2_Name_AfterUpdate()
Me.Parent_2_Code = Me.Parent_2_Name.Column(0)
End Sub
'Auto populate entity 3 name
Private Sub Parent_3_Code_AfterUpdate()
Me.Parent_3_Name = Me.Parent_3_Code.Column(1)
End Sub
' auto populate entity 3 code based on name
Private Sub Parent_3_Name_AfterUpdate()
Me.Parent_3_Code = Me.Parent_3_Name.Column(0)
End Sub
'Auto populate entity 4 name
Private Sub Parent_4_Code_AfterUpdate()
Me.Parent_4_Name = Me.Parent_4_Code.Column(1)
End Sub
' auto populate entity 4 code based on name
Private Sub Parent_4_Name_AfterUpdate()
Me.Parent_4_Code = Me.Parent_4_Name.Column(0)
End Sub
' auto populate entity 5 code based on name
Private Sub Parent_5_Name_AfterUpdate()
Me.Parent_5_Code = Me.Parent_5_Name.Column(0)
End Sub
 
'Auto populate entity 5 name
Private Sub Parent_5_Code_AfterUpdate()
Me.Parent_5_Name = Me.Parent_5_Code.Column(1)
End Sub
'Auto Populate Entity 6 name based on code
Private Sub Parent_6_Code_AfterUpdate()
Me.Parent_6_Name = Me.Parent_6_Code.Column(1)
End Sub
' Auto populate entity 6 code based on name
Private Sub Parent_6_Name_AfterUpdate()
Me.Parent_6_Code = Me.Parent_6_Name.Column(0)
End Sub
'Auto Populate Entity 7 name based on code
Private Sub Parent_7_Code_AfterUpdate()
Me.Parent_7_Name = Me.Parent_7_Code.Column(1)
End Sub
' Auto populate entity 7 code based on name
Private Sub Parent_7_Name_AfterUpdate()
Me.Parent_7_Code = Me.Parent_7_Name.Column(0)
End Sub
'Auto Populate Entity 8 name based on code
Private Sub Parent_8_Code_AfterUpdate()
Me.Parent_8_Name = Me.Parent_8_Code.Column(1)
End Sub
' Auto populate entity 8 code based on name
Private Sub Parent_8_Name_AfterUpdate()
Me.Parent_8_Code = Me.Parent_8_Name.Column(0)
End Sub
'Auto Populate Entity 9 name based on code
Private Sub Parent_9_Code_AfterUpdate()
Me.Parent_9_Name = Me.Parent_9_Code.Column(1)
End Sub
' Auto populate entity 9 code based on name
Private Sub Parent_9_Name_AfterUpdate()
Me.Parent_9_Code = Me.Parent_9_Name.Column(0)
End Sub
'grey out stat section section button code
Private Sub Stat_Audit_Yes_No_AfterUpdate()
Me.Stat_Year_End.Enabled = Me.Stat_Audit_Yes_No
Me.FS_Type_1.Enabled = Me.Stat_Audit_Yes_No
Me.Service_Provider_1.Enabled = Me.Stat_Audit_Yes_No
Me.Stat_Date_1.Enabled = Me.Stat_Audit_Yes_No
Me.FS_Type_2.Enabled = Me.Stat_Audit_Yes_No
Me.Service_Provider_2.Enabled = Me.Stat_Audit_Yes_No
Me.Stat_Date_2.Enabled = Me.Stat_Audit_Yes_No
Me.Tax_Reporting_Type.Enabled = Me.Stat_Audit_Yes_No
Me.Service_Provider_3.Enabled = Me.Stat_Audit_Yes_No
Me.Stat_Date_3.Enabled = Me.Stat_Audit_Yes_No
End Sub
 
Private Sub dupilicate_record_Click()
On Error GoTo Err_dupilicate_record_Click
 
    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
Exit_dupilicate_record_Click:
    Exit Sub
 
Err_dupilicate_record_Click:
    MsgBox Err.Description
    Resume Exit_dupilicate_record_Click
 
End Sub
Private Sub save_record_Click()
On Error GoTo Err_save_record_Click
 
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Exit_save_record_Click:
    Exit Sub
Err_save_record_Click:
    MsgBox Err.Description
    Resume Exit_save_record_Click
 
End Sub
Private Sub undo_record_Click()
On Error GoTo Err_undo_record_Click
 
    DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
Exit_undo_record_Click:
    Exit Sub
Err_undo_record_Click:
    MsgBox Err.Description
    Resume Exit_undo_record_Click
 
End Sub
Private Sub print_record_Click()
On Error GoTo Err_print_record_Click
 
    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.PrintOut acSelection
Exit_print_record_Click:
    Exit Sub
Err_print_record_Click:
    MsgBox Err.Description
    Resume Exit_print_record_Click
 
End Sub
Private Sub Combo122_AfterUpdate()
    ' Find the record that matches the control.
    Dim rs As Object
    Set rs = Me.Recordset.Clone
    rs.FindFirst "[Record ID] = '" & Me![Combo122] & "'"
    If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
Private Sub Command133_Click()
On Error GoTo Err_Command133_Click
 
    DoCmd.GoToRecord , , acNewRec
Exit_Command133_Click:
    Exit Sub
Err_Command133_Click:
    MsgBox Err.Description
    Resume Exit_Command133_Click
 
End Sub
 
You need to redesign your database into a relational structure and use subforms.

This would require only a tiny fraction of the code your current design requires.
 

Users who are viewing this thread

Back
Top Bottom