Valhalla Legends Forums Archive | Visual Basic Programming | Error 5 - Invalid Procedure Call or Argument

AuthorMessageTime
Grok
Error 5 is one of the least-intuitive errors that VB throws.

[code]
        Case "Field"
            'get parent(fields).parent(profile).name
            Set mProfile = KI.Profiles(Node.Parent.Parent.Text)
            Set mField = mProfile.Fields(Node.Text)
[/code]

Consider the above code.  The last line throws the error sometimes.  The value of Node.Text is valid, with the value being one of the keys in the Fields collection.  The Fields collection exists, the mProfile object exists.  Yet that line throws error 5 in rare circumstances.

Wish I knew why.  Anyone here really understand VB error 5?
October 25, 2004, 2:33 PM
LivedKrad
In any and all cases, can you guarantee that all of your objects or values are absolutely valid throughout the entire procedure?
October 25, 2004, 5:09 PM
Adron
Have you been able to reproduce in the debugger? What about getting a dump file? :P
October 25, 2004, 5:21 PM
Grok
[quote author=Adron link=topic=9312.msg86082#msg86082 date=1098724904]
Have you been able to reproduce in the debugger? What about getting a dump file? :P
[/quote]

Ah, yes, the AdronVBErrorDump DLL .... I should find that again.
October 25, 2004, 7:22 PM
Myndfyr
[quote author=Grok link=topic=9312.msg86094#msg86094 date=1098732123]
[quote author=Adron link=topic=9312.msg86082#msg86082 date=1098724904]
Have you been able to reproduce in the debugger? What about getting a dump file? :P
[/quote]

Ah, yes, the AdronVBErrorDump DLL .... I should find that again.
[/quote]

Out of curiousity, do you have a conditional Dim?  That is, is mField being declared sometimes and sometimes not, depending on your code path?
October 25, 2004, 7:23 PM
Grok
[quote author=MyndFyre link=topic=9312.msg86095#msg86095 date=1098732195]
[quote author=Grok link=topic=9312.msg86094#msg86094 date=1098732123]
[quote author=Adron link=topic=9312.msg86082#msg86082 date=1098724904]
Have you been able to reproduce in the debugger? What about getting a dump file? :P
[/quote]

Ah, yes, the AdronVBErrorDump DLL .... I should find that again.
[/quote]

Out of curiousity, do you have a conditional Dim?  That is, is mField being declared sometimes and sometimes not, depending on your code path?
[/quote]

No conditional Dim.  Didn't know I could anyway.  Plus, at the point of error when I let the program break, it is on that line and the values of everything are defined.  The count is correct and the key I am looking for is in the collection.  Item is the default property of the collection.  The class is solid afaik, getting 10,000+ calls per day by about 5 different processes.
October 25, 2004, 7:45 PM
Adron
[quote author=Grok link=topic=9312.msg86100#msg86100 date=1098733528]
No conditional Dim.  Didn't know I could anyway.  Plus, at the point of error when I let the program break, it is on that line and the values of everything are defined.  The count is correct and the key I am looking for is in the collection.   Item is the default property of the collection.  The class is solid afaik, getting 10,000+ calls per day by about 5 different processes.
[/quote]

But you've got it in the debugger? If you have, shouldn't it be easy to figure just by picking out one piece of the statement at a time and evaluating that?
October 25, 2004, 10:21 PM

Search