Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Unexpected Error 50003 - This is a good one!

Unexpected Error 50003 - This is a good one!

Unexpected Error 50003 - This is a good one!


This is the problem explained in some detail below:

I run a VB  5 exe on a Citrix server (NT) which is accessed by the user via thin client technology. I have the source code on my laptop (Win98) which is where i do all my developing of code, I also compile the code on my laptop and then update the server with the new exe as and when needed.

The problem i am having is recently, when i amend code and compile the exe on my laptop and then copy it over to the server - the exe runs fine but certain forms within the application when attempted to be accessed throws up the error below which is then handled appropriately within my code (ie chucks me out to main MDI form without causing a fatal error):

    50003: Unexpected Error

The thing that really gets me is that if I point the ODBC connection on my Laptop to the live d/base and run the exe on my Laptop everything runs perfectly and all forms can be accessed! So i can't even re-create the error on test in order to debug it thoroughly ......... Another thing as well - if i revert back to a previous exe the forms within the application which cause the error, open perfectly with no errors on the server - help!

The only thing which has changed over the last few months is that our company has changed from a Novell network to a MS exchange network, so I have a sneaking suspicion  it is a Dll, Ocx version problem between the server and my laptop??

Thanks in advance, Chris

RE: Unexpected Error 50003 - This is a good one!

I can't help, but I just love the phrase 'Unexpected Error'. The implication is that errors which don't say they're UNEXpected, must therefore be EXpected!

Mind you, someone said that if Debugging is the art of taking errors OUT of code, then Programming must be the art of putting them IN!

Jim Brown,
South Africa.
My time is GMT+2

RE: Unexpected Error 50003 - This is a good one!


It sounds like your error handling is not good enough to identify the line of code causing the error. This makes it very difficult to resolve problems which cannot be reproduced in a test environment. When an error is encountered you need to store the error line number (erl) as well as the routine name, so that this information can be logged or displayed. Of course you also need to ensure that all lines are uniquely numbered so that erl contains something useful.

Regarding the phrase "unexpected error", I agree this sounds like a tautology, but it is not really. VB can raise errors in situations which are expected e.g. when a file is missing. These are "expected errors" and should be handled by specific code. Any other errors are "unexpected errors" and should be handled by an appropriate generic error handling mechanism.


RE: Unexpected Error 50003 - This is a good one!

This is all I could find:
Is there a gif on your form -> http://support.microsoft.com/default.aspx?scid=kb;EN-US;q194414

Is there a reference to a control or com component that is missing or (more probebly) of an older version?

Looking on the MS site I can see that they use this if an error occured that they cannot explain (did not expect when they made the sollution) and is quickly referred to as a BUG.

Did you change the MDAC on the NT machine / are they the same as on your laptop?

This is for GlynA:

How do you get a line number when an error occures??

RE: Unexpected Error 50003 - This is a good one!


Whenever an error is raised the variable erl contains the line number. This is not very well documented by Microsoft. This is probably because they view line numbers as archaic.


RE: Unexpected Error 50003 - This is a good one!

Thanks again

I've found a program which compares all dlls/ocx's for a specified exe on two separate machines and it shows that some dlls which the exe references are different on the NT server than my on laptop (NT has older dlls) - i'll try and bring them in line to see if this has any effect ...

RE: Unexpected Error 50003 - This is a good one!

Ha ha ha ha ha ha ha ha ha ha GREAAAT!!!!!!!

Private Sub Form_Load()
1 Dim somevar As Integer
2 On Error GoTo errhand
3 somevar = 22
4 MsgBox somevar / 0

Exit Sub
MsgBox "The error occured in line: " & Erl
End Sub

I will extually get 4 star 4 you Glyn.

Two more questions:

1. Is there a setting in VB that makes the
   line numbers for you? I have never worked
   with the line numbers (exept on the commadore).
2. Should I remove the line numbers when the app
   goes into production?

RE: Unexpected Error 50003 - This is a good one!

1. No, VB does not do it for you. Have a look at the add-in available at http://www.geocities.com/keith_dimmock/kdaddin2.html which will do this.

2. Leave the line number in. they can be very helpful in fixing bugs that escaped the testing process.


RE: Unexpected Error 50003 - This is a good one!

HI Chris,

It's not a joke. Try to change you Color resolution setting
in the "Display Properties" to 16 Bits or less.

I add the same problem on WIN98 because the color setting were 32 Bits. I changed it to 16 Bits and all my forms were able to load whit no "Unexpected Error 50003".


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close