I'd agree that your approach is better, Mark, but the Resume Next should
send program execution back to the line after that line that caused the
error.
Take a look at this test routine:
Sub Test()
On Error GoTo Err_Test
Dim sngQuotient As Single
Debug.Print "This is before the error."
sngQuotient = 1 / 0
Debug.Print "This is after the error."
End_Test:
Exit Sub
Err_Test:
If Err.Number = 11 Then
Debug.Print "Error number 11"
Resume Next
End If
Debug.Print "This is in the error handler."
Resume End_Test
End Sub
Here's what I see when I run it:
This is before the error.
Error number 11
This is after the error.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"Mark A. Sam"
news:%23rHUBVHKIHA.4752@TK2MSFTNGP05.phx.gbl...
> Try this:
>
> Err_Command7_Click:
> If Err.Number = 8512 Then
> Resume Next
> Else
> MsgBox Err.Description & Err.Number
> Resume Exit_Command7_Click
> End If
>
> The way you wrote it, the message box will still display, even though you
> said Resume next.
>
> God Bless,
>
> Mark A. Sam
>
> "pubdude2003"
>> Hey all....
>>
>> I am getting a dialogue that says
>>
>> "None of the field names you pasted onto the Clipboard match the field
>> names
>> on the form."
>>
>> When I paste records from the clipboard to a form I've created. The paste
>> works fine, I just want to kill the dialogue so that my less than bright
>> clientele don't call me to ask me whether they should click Yes or No.
>> The
>> err.number (error... well it's not technically is it?) is 8512 but this
>> code
>> isn't killing the dialogue.... (and now on further testing the six sites
>> that
>> said this error was 8512 were fibbing a bit, the err.number isn't 8512
>> which
>> may well be why the code is not trapping... sigh.. anywaaaaay)
>>
>> Err_Command7_Click:
>> If Err.Number = 8512 Then
>> Resume Next
>> End If
>> MsgBox Err.Description & Err.Number
>> Resume Exit_Command7_Click
>>
>> Thoughts anyone?
>>
>> --
>> Message posted via AccessMonster.com
>> http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200711/1
>>
>
>