Hi all,
I'm having difficulty catching error 8511, which states:
"Records that Microsoft Office Access was unable to paste have been inserted into a new table called 'Paste Errors' In the Database window, open the new table to see the unpasted records. After you fix the problems that resulted in the paste errors, copy and paste the records from the new table."
What generally happens is people copy data from Excel and paste it over data in MS Access, but if they mismatch the columns or if some data was pasted into a combo box without a matching item in the list or a field has too much text for the back end table to accept, then it fails to update the record and gives the above message.
My goal is to rewrite the message since people are locked out from seeing the back panel with all the tables but only get a switchboard, thus making the above message meaningless. My desired error handler code is below:
I cannot catch it with the Form_Error event, so please let me know how to catch the error.
Thanks!
I'm having difficulty catching error 8511, which states:
"Records that Microsoft Office Access was unable to paste have been inserted into a new table called 'Paste Errors' In the Database window, open the new table to see the unpasted records. After you fix the problems that resulted in the paste errors, copy and paste the records from the new table."
What generally happens is people copy data from Excel and paste it over data in MS Access, but if they mismatch the columns or if some data was pasted into a combo box without a matching item in the list or a field has too much text for the back end table to accept, then it fails to update the record and gives the above message.
My goal is to rewrite the message since people are locked out from seeing the back panel with all the tables but only get a switchboard, thus making the above message meaningless. My desired error handler code is below:
Code:
Private Sub Form_Error(DataErr As Integer, Response As Integer) Call basicErrors(DataErr, Response) End Sub ... Sub basicErrors(ByRef DataErr As Integer, ByRef Response As Integer) If DataErr = 2113 Then Call MsgBox("The value you entered isn't valid for this field (i.e. text in numeric field)." & Chr(13) & Chr(13) & _ "To undo entry for this field, press ESC.", vbInformation, "Lists & Registers Database") Response = acDataErrContinue ElseIf DataErr = 2237 Then Call MsgBox("The text you entered isn't an item in the list." & Chr(13) & Chr(13) & _ "To undo entry for this field, press ESC.", vbInformation, "Lists & Registers Database") Response = acDataErrContinue ElseIf DataErr = 8511 Then Call MsgBox("This record could not be updated, likely due to invalid text entered into some of the drop down boxes " & Chr(13) & _ "or some of the text exceeding the maximum allowable text length for a field." & Chr(13) & Chr(13) & _ "If pasting from excel, make sure the columns in excel line up exactly with the columns in MS Access " & Chr(13) & _ "and that any data that is part of a drop down box is actually selectable from the drop down box.", vbInformation, "Lists & Registers Database") Response = acDataErrContinue End If End Sub
Thanks!
Comment