|
-
Dec 8th, 2010, 10:49 AM
#1
Thread Starter
New Member
On Error VBA
I have a little problem with the On Error Goto event. Does not seem like it catches the error all the time. It does sometimes. I am using VBA in Access. Here's some of the code that I am using with the on error statement. I get a Error number 91 when it tries to pull the information from the website if there is no data to pull. Any help is appreciated.
Code:
On Error GoTo Skip:
AtmsQualsLength = WebBrowser1.Document.getelementbyid("tblQuals").rows.length - 1
Skip:
If Err.Number = 91 Then
MsgBox stblBadgeNumber(i) & " is not found in ATMS!"
Err.Clear
End If
Thanks,
TheChazm
-
Dec 8th, 2010, 11:30 AM
#2
Re: On Error VBA
Code:
If WebBrowser1.Document.getelementbyid("tblQuals") Is Nothing Then
AtmsQualsLength = WebBrowser1.Document.getelementbyid("tblQuals").rows.length - 1
Else
MsgBox stblBadgeNumber(i) & " is not found in ATMS!"
End If
-
Dec 8th, 2010, 11:42 AM
#3
Thread Starter
New Member
Re: On Error VBA
Thanks! I'll give that a shot and see if it works better. I know it does look better. I think I got wrapped around error handling to much.
I'll post back soon and let you know.
TheChazm
-
Dec 8th, 2010, 12:38 PM
#4
Re: On Error VBA
Also, your error routine will run every single solitary time you run your code because you are not existing your routine if there is no error
Code:
On Error GoTo Skip 'do not need a colon here
AtmsQualsLength = WebBrowser1.Document.getelementbyid("tblQuals").rows.length - 1
Exit Sub 'add this
Skip:
If Err.Number = 91 Then
MsgBox stblBadgeNumber(i) & " is not found in ATMS!"
Err.Clear
End If
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|