cossy74
asked on
VB and errors
Hi
currently i have this peice of code:
On Error Resume Next
Err.Clear
Call oServer.Connect(m_sSystem, m_sUsername, m_sPassword)
Call DBGValue("Err.Number", Err.Number)
Select Case Err.Number
Case "70"
Call DBG("Permission Denied")
Case "0"
Call DBG("No Error")
Case Default
Call DBG("Has Error")
End Select
My problem is this the DBGValue show me the Err.Number is 70 but the Case statement show the Number being 0
what is happening?
currently i have this peice of code:
On Error Resume Next
Err.Clear
Call oServer.Connect(m_sSystem,
Call DBGValue("Err.Number", Err.Number)
Select Case Err.Number
Case "70"
Call DBG("Permission Denied")
Case "0"
Call DBG("No Error")
Case Default
Call DBG("Has Error")
End Select
My problem is this the DBGValue show me the Err.Number is 70 but the Case statement show the Number being 0
what is happening?
e.g.
On Error Resume Next
Err.Clear
Call oServer.Connect(m_sSystem, m_sUsername, m_sPassword)
Call DBGValue("Err.Number", Err.Number)
Select Case Err.Number
Case 70
Call DBG("Permission Denied")
Case 0
Call DBG("No Error")
Case Default
Call DBG("Has Error")
End Select
On Error Resume Next
Err.Clear
Call oServer.Connect(m_sSystem,
Call DBGValue("Err.Number", Err.Number)
Select Case Err.Number
Case 70
Call DBG("Permission Denied")
Case 0
Call DBG("No Error")
Case Default
Call DBG("Has Error")
End Select
PS. Err.Clear is not needed, as 'On Error Resume Next' resets the Err object anyway.
ASKER
fanpages: I change ot your code and still the same thing any suggestion
Please post the code that relates to the DBGValue() function.
Do you use an 'On Error...' statement within this function, because if you do, Err.Number will be reset to 0.
BFN,
fp.
Do you use an 'On Error...' statement within this function, because if you do, Err.Number will be reset to 0.
BFN,
fp.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Your Case statements are checking for Strings; try changing Case "70" to Case 70, & Case "0" to Case 0.
BFN,
fp.