Thanks! btw it was 2046...
john
"Bas Cost Budde" <b.costbudde.RemoveThis@dev.null.com> schreef in bericht
news:ef2krj$jmu$1@localhost.localdomain...
>I do this in two steps:
>
> First, find out what error is thrown. Put 'on error resume next' before
> the offending line, and
>
> if err>0 then msgbox err.number & ":" & err.description
>
> afterwards. Now, force the error to occur, in this case, executing with an
> empty clipboard. Aha: 2501 action is not available (giving the number from
> my head, it may be another one).
>
> Now you can refine the If statement:
>
> if err=2501 then
> exit sub
> else
> ' do whatever you wish for a less expected error.
> ' Signal it and indicate what the user could do
> end if
>
> john schreef:
>> In a button I have this code:
>>
>> Testfield.SetFocus
>> DoCmd.RunCommand acCmdPaste
>>
>> When the clipboard is empty this gives an error saying that this action
>> is not available at the moment. I'd like to trap for this error, prevent
>> the message from showing, and stop the whole routine that comes after
>> this code.
>> What would be the best way to do this?
>> thanks,
>> john
>
> --
> Bas Cost Budde
> Holland >> Stay informed about: Trap for 'clipboard is empty' 'error'