Welcome to dbFreaks.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Trap for 'clipboard is empty' 'error'

 
   Database Help (Home) -> MS Access RSS
Next:  HELP Please! Type mismatch error  
Author Message
john

External


Since: Jul 12, 2006
Posts: 82



(Msg. 1) Posted: Sat Sep 23, 2006 7:15 am
Post subject: Trap for 'clipboard is empty' 'error'
Archived from groups: comp>databases>ms-access (more info?)

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

 >> Stay informed about: Trap for 'clipboard is empty' 'error' 
Back to top
Login to vote
Bas Cost Budde

External


Since: Sep 18, 2006
Posts: 47



(Msg. 2) Posted: Sat Sep 23, 2006 8:39 am
Post subject: Re: Trap for 'clipboard is empty' 'error' [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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' 
Back to top
Login to vote
john

External


Since: Jul 12, 2006
Posts: 82



(Msg. 3) Posted: Sat Sep 23, 2006 11:29 am
Post subject: Re: Trap for 'clipboard is empty' 'error' [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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' 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
How to empty the clipboard - Dear reader, By closing a form after deleting one record, I received a warning telling me: "You copied a large amount of data onto the clipboard." I delete the record with the "cut" command and I have not the intention to pas...

How to trap ODBC error mesage in Error event ? - Dear all, How to trap specifig ODBC error message in Error event (duplicate value error) ? Thanks. Vensia

Error Trap Null Values - Hi, I'm trying to write an error trap that won't let you continue unless a price is entered. This is what I have so far. Private Sub ForecastProductSale_BeforeUpdate(Cancel As Integer) If IsNull(Me.ForecastProductSale) Then MsgBox "A P...

Error Trap Zero or Null Values - Hi, I'm trying to write code that will not allow users to continue unless a Product Sale is entered. This is what I have so far: Private Sub ForecastProductSale_BeforeUpdate(Cancel As Integer) If Nz(JobEstimatedProductSale, "") = "&q...

Can't trap error in called routine - I'm using the following routine to call UpdateDiary() - below: Private Sub Form_BeforeUpdate(Cancel As Integer) On Error GoTo Form_BeforeUpdate_Error Call UpdateDiary(Me!TenantCounter, "sfTenantDetailsOther") Exit ...
   Database Help (Home) -> MS Access All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]