Discussion Locked

Object no longer valid

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I wonder if you know why an object will become no longer valid in VB Script?

What I am doing is initially calling a function which will search through the all of the days that a person has had off. In this case we have one employee how has been off for nearly 1/4 of a yr. I know my function works as I have debugged it carefully and ensured all lines of the function are called at one stage or another.

However, when control returns to the calling code the system generates an error saying "Object no longer valid" and shows the line which contains the call to the function. for example :

startdate = getStartDate(EmpID, EndDate)

I have checked that all my variables are declared and correct and cannot understand why the system generates an error at this point.

I am not having any fun with this.

5 replies

by fofa

Maybe you are terminating the object before the main routine is done with it. As an example if you are unloading the object in the object code, the main code is still ref. it (trying to assign the value to startdate).

by steven_v_brown

Before I can answer this question I need to know the following:

What data type (DIM startdate as ???) is startdate ?

What data type (function getStartDate(byRef EmpID, byRef EndDate) as ??? ) is getStartDate?

Are you validating that EndDateis a valid date when the code is being stepped?

How does error handling control Database error? (Time Out's, No data, NULLS, etc...)

At one time or another I have experience all the above.

Good Luck!
Steven_V_Brown@hotmail.com

This discussion is closed to new replies.