PC Review


Reply
Thread Tools Rate Thread

check box error

 
 
Afrosheen
Guest
Posts: n/a
 
      24th Sep 2008
I have a check box that when I check it it gives me an error. The error is:
Error 0() in procedure Trainer_Click. Here is the code:

'---------------------------------------------------------------------------------------
' Procedure : Trainer_Click
' Author : 3710opr1
' Date : 9/23/2008
' Purpose
'---------------------------------------------------------------------------------------
'
Private Sub Trainer_Click()
10 On Error GoTo Err_Trainer_Click
20 If Trainer Then
30 cmdToggle.Enabled = True
40 Else
50 cmdToggle.Enabled = False
60 End If

Err_Trainer_Click:
70 Call LogError(Err.Number, Err.Description, "Trainer_Click()")
80 MsgBox "Error " & Err.Number & " (" & Err.Description & ") in
procedure Trainer_Click of VBA Document Form_Copy of frm_roster"
End Sub

I get the error if I click on or off. I have another form with the same code
and it works fine.

Thanks for reading this.
 
Reply With Quote
 
 
 
 
fredg
Guest
Posts: n/a
 
      24th Sep 2008
On Tue, 23 Sep 2008 20:22:02 -0700, Afrosheen wrote:

> I have a check box that when I check it it gives me an error. The error is:
> Error 0() in procedure Trainer_Click. Here is the code:
>
> '---------------------------------------------------------------------------------------
> ' Procedure : Trainer_Click
> ' Author : 3710opr1
> ' Date : 9/23/2008
> ' Purpose :
> '---------------------------------------------------------------------------------------
> '
> Private Sub Trainer_Click()
> 10 On Error GoTo Err_Trainer_Click
> 20 If Trainer Then
> 30 cmdToggle.Enabled = True
> 40 Else
> 50 cmdToggle.Enabled = False
> 60 End If
>
> Err_Trainer_Click:
> 70 Call LogError(Err.Number, Err.Description, "Trainer_Click()")
> 80 MsgBox "Error " & Err.Number & " (" & Err.Description & ") in
> procedure Trainer_Click of VBA Document Form_Copy of frm_roster"
> End Sub
>
> I get the error if I click on or off. I have another form with the same code
> and it works fine.


I doubt it is the same code.

>
> Thanks for reading this.


Your code runs directly into the Err_Trainer_Click even if there is no
error. You should exit the sub before that point, so that unless there
is an error, the error handler does not run.
You should also clear the error, if there is one, and resume
somewhere.
\
Private Sub Trainer_Click()
10 On Error GoTo Err_Trainer_Click
20 If Trainer Then
30 cmdToggle.Enabled = True
40 Else
50 cmdToggle.Enabled = False
60 End If

65 Exit_Sub:
66 Exit Sub

Err_Trainer_Click:
70 Call LogError(Err.Number, Err.Description,
Trainer_Click()")
80 MsgBox "Error " & Err.Number & " (" & Err.Description & ")
in procedure Trainer_Click of VBA Document Form_Copy of frm_roster"

85 Resume Exit_Sub ' clear the error and exit the sub

End Sub
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook Signature error during spell check Text marked with "Do not check spelling or grammar" was skipped. John Peters Microsoft Outlook 0 25th Sep 2007 07:48 PM
Error message: Data error (cyclic redundancy check) =?Utf-8?B?Q0RS?= Microsoft Outlook Discussion 1 9th Nov 2006 04:28 PM
Error 'Error evaluating CHECK constraint' in the validation rule. =?Utf-8?B?Um8=?= Microsoft Access 2 19th Sep 2006 08:47 AM
No reboot After Error Check Tool (Check Disk) Pat B Windows XP Hardware 0 23rd May 2006 05:54 PM
Check SQL Query - if correct, no syntax error, procee some task, if error found, stop AAA Microsoft Dot NET Compact Framework 2 18th Nov 2005 06:28 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:43 PM.