VB 6 Error 0

How Do I Solve This

Page 1 of 1

10 Replies - 38464 Views - Last Post: 13 February 2012 - 02:34 PM Rate Topic: -----

#1 Aclypses   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 19-February 06

VB 6 Error 0

Posted 19 February 2006 - 12:54 PM

Have written a DB accessing program, but encounter Error 0 at run-time, and on-board help is useless with this type of error. :huh: :huh: Completely baffled please help.
Is This A Good Question/Topic? 0
  • +

Replies To: VB 6 Error 0

#2 Amadeus   User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 250
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: VB 6 Error 0

Posted 19 February 2006 - 02:27 PM

I'm afriad you'll have to be a bit more specific. Can you post the code?
Was This Post Helpful? 0
  • +
  • -

#3 born2c0de   User is offline

  • printf("I'm a %XR",195936478);
  • member icon

Reputation: 187
  • View blog
  • Posts: 4,673
  • Joined: 26-November 04

Re: VB 6 Error 0

Posted 20 February 2006 - 03:09 AM

Which DB are you accessing?
Which DB Interface are you using? ADODB or ADODC or Intrinsic Data Control?
As Amadeus said...you need to be more specific to get better help.
Was This Post Helpful? 0
  • +
  • -

#4 kamiru   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 25-August 07

Re: VB 6 Error 0

Posted 25 August 2007 - 03:26 AM

View Postborn2c0de, on 20 Feb, 2006 - 03:09 AM, said:

Which DB are you accessing?
Which DB Interface are you using? ADODB or ADODC or Intrinsic Data Control?
As Amadeus said...you need to be more specific to get better help.

I am expiriencing the same proble of err.number=0.This error is not in the list of VB errors.
This error occurs when am logged to a machine with a restricted user and am trying to save an image to a folder that does not Exist....Can someone please give me advice on why the error fires if the user has no rights.
thank u.
Was This Post Helpful? 0
  • +
  • -

#5 PsychoCoder   User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1659
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: VB 6 Error 0

Posted 25 August 2007 - 05:02 AM

If you're not trying to save the file in your code then this is in the wrong forum, if you're indeed trying to save the file in your code and its a limited account the account may not have permissions to create the folder. Try saving it in a folder that actually exists and see if it works then.
Was This Post Helpful? 0
  • +
  • -

#6 kamiru   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 25-August 07

Re: VB 6 Error 0

Posted 25 August 2007 - 05:32 AM

View PostPsychoCoder, on 25 Aug, 2007 - 05:02 AM, said:

If you're not trying to save the file in your code then this is in the wrong forum, if you're indeed trying to save the file in your code and its a limited account the account may not have permissions to create the folder. Try saving it in a folder that actually exists and see if it works then.





This error occurs only the user has no admin rights.If the folder Iam trying to access does not exist i raise an error the display a User warning message.This work fine with a user who has rights..But on the other hand if the user has no rights the error is not raised..it throws error number 0.
Was This Post Helpful? 0
  • +
  • -

#7 PsychoCoder   User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1659
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: VB 6 Error 0

Posted 25 August 2007 - 07:16 AM

Well check for your error & if the error number is 0. If its 0 let them know they dont have sufficient rights, if its your specified error then just display it. I believe in VB6 its if err.Number = 0
Was This Post Helpful? 0
  • +
  • -

#8 born2c0de   User is offline

  • printf("I'm a %XR",195936478);
  • member icon

Reputation: 187
  • View blog
  • Posts: 4,673
  • Joined: 26-November 04

Re: VB 6 Error 0

Posted 26 August 2007 - 01:14 AM

Quote

I am expiriencing the same proble of err.number=0.This error is not in the list of VB errors.

That's because Error Number 0 refers to NO ERROR. I've never seen an Error Raised with Code 0 before. Its very strange.

Call the GetLastError() API Function and see what it returns.
Private Declare Function GetLastError Lib "kernel32" Alias "GetLastError" () As Long

Was This Post Helpful? 0
  • +
  • -

#9 Sachin_Ghalme   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 28-March 11

Re: VB 6 Error 0

Posted 28 March 2011 - 07:08 AM

View PostAclypses, on 19 February 2006 - 12:54 PM, said:

Have written a DB accessing program, but encounter Error 0 at run-time, and on-board help is useless with this type of error. :huh: :huh: Completely baffled please help.


use following code
On Error GoTo OpenFileError
Open "A:\JUNK.TXT" For Input As #1
MsgBox "File was opened successfully"
Close #1
Exit Sub     ' Mention U Use Exit Sub Before goto label i.e OpenFileError
OpenFileError:
MsgBox "The following error occured: " & vbNewLine _
& "Error # " & Err.Number & vbNewLine _
& Err.Description, _
vbCritical, _
"Open Error"
 
End Sub


MOD EDIT: When posting code...USE CODE TAGS!!!

:code:

This post has been edited by JackOfAllTrades: 28 March 2011 - 09:25 AM

Was This Post Helpful? 0
  • +
  • -

#10 BobRodes   User is offline

  • Product Manager
  • member icon

Reputation: 601
  • View blog
  • Posts: 3,072
  • Joined: 19-May 09

Re: VB 6 Error 0

Posted 28 March 2011 - 09:28 AM

Here's a simple way to replicate the exact problem:
Private Sub Command1_Click()
On Error GoTo ErrHandle
'Substitute your code here
MsgBox "Hello, World!"
'Done with your code
ErrHandle:
MsgBox "Error " & Err.Number
End Sub

I have no idea whether it applies to your situation, of course. I'll put in more work if you will.

(I'm thinking we probably ought to rule out the possibility that the OP failed to exit the sub before hitting his error handler, before we get too far into this.)

This post has been edited by BobRodes: 28 March 2011 - 09:27 AM

Was This Post Helpful? 0
  • +
  • -

#11 ArcDarkSmurf   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 12
  • Joined: 01-October 09

Re: VB 6 Error 0

Posted 13 February 2012 - 02:34 PM

View Postborn2c0de, on 26 August 2007 - 02:14 AM, said:

Quote

I am expiriencing the same proble of err.number=0.This error is not in the list of VB errors.

That's because Error Number 0 refers to NO ERROR. I've never seen an Error Raised with Code 0 before. Its very strange.

Call the GetLastError() API Function and see what it returns.
Private Declare Function GetLastError Lib "kernel32" Alias "GetLastError" () As Long



Most likely the reason you are getting an error code of 0 is because you failed
to exit the sub-routine before the errorhandler. Your are exactly right that the
error code of 0 represents NO ERROR.
EX:

Private Sub FakeRoutine()
     On Error GoTo ErrorHandler:

**** Your Code Here ****

(If the process was successful)
EXIT SUB <------------------- This is your important step
ErrorHandler:
 MsgBox "Display Error"




The reason for this is because VB6 doesn't have TRY/CATCH loops
so its just reading the code line by line

Hope this helps!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1