Passing Dictionary object byref

Ive created an ASP class that uses a dictionary object which is filled
from a recordset. It passes the object to the propterty of another ASP
class byref:

Public Property Let dicReplaceVars(byref vdicReplaceVars)
set p_ReplaceVars = vdicReplaceVars
End Property


Private p_ReplaceVars


where it is used in this other class a few times to replace values in
an array:

Function ReplaceVars(vArrayItem)

' turn it into an array split at spaces
vArrayItem = split(vArrayItem," ")
' loop through the array
for count = lbound(vArrayItem) to ubound(vArrayItem)

'See if it is a replacement variable and exists in the dictionary
if left(vArrayItem(count),6) = "tkRep_" and
p_ReplaceVars.exists(vArrayItem(count)) then
' then replace it
Error occurs here >> vArrayItem(count) =
p_ReplaceVars.Item(cstr(vArrayItem(count)))
end if
next

dim vArrayItemNew
vArrayItemNew = ""

' Loop through the array and put it back together
for count = lbound(vArrayItem) to ubound(vArrayItem)

if vArrayItem(count) = ubound(vArrayItem) then
vArrayItemNew = vArrayItemNew & vArrayItem(count)
else
vArrayItemNew = vArrayItemNew & vArrayItem(count) & " "
end if
next

' return the vArrayItemNew to the function
ReplaceVars = vArrayItemNew
End Function

The error message I get is:

ADODB.Field (0x800A0D5C)
Object is no longer valid.
D:\WWW\LCDEV\DOC_FUNCTIONS\../classes/classlcDocTKit_item.asp, line 52

However I have no idea why, it is a dictionary object and not a
recordset, the object should still be open.

Any help is greatly appreciated.

Thanks

Re: Passing Dictionary object byref by Ray

Ray
Mon Sep 15 07:50:59 CDT 2003

Are you looking at the right line in the right page? Like, is
classlcDocTKit_item.asp an include file perhaps, and you're looking at line
52 in the page with the include directive instead?

Ray at work

"Ryan Malone" <ryanswebsite@hotmail.com> wrote in message
news:e8386b53.0309150055.f36d9e6@posting.google.com...

>
> ADODB.Field (0x800A0D5C)
> Object is no longer valid.
> D:\WWW\LCDEV\DOC_FUNCTIONS\../classes/classlcDocTKit_item.asp, line 52
>
> However I have no idea why, it is a dictionary object and not a
> recordset, the object should still be open.
>
> Any help is greatly appreciated.
>
> Thanks



Re: Passing Dictionary object byref by ryanswebsite

ryanswebsite
Mon Sep 15 21:11:29 CDT 2003

Hi Ray

Thanks for the reply, the code that ive included is from
classlcDocTKit_item.asp. It has got me completely stumped.



"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message news:<eP9MFg4eDHA.2332@TK2MSFTNGP12.phx.gbl>...
> Are you looking at the right line in the right page? Like, is
> classlcDocTKit_item.asp an include file perhaps, and you're looking at line
> 52 in the page with the include directive instead?
>
> Ray at work
>
> "Ryan Malone" <ryanswebsite@hotmail.com> wrote in message
> news:e8386b53.0309150055.f36d9e6@posting.google.com...
>
> >
> > ADODB.Field (0x800A0D5C)
> > Object is no longer valid.
> > D:\WWW\LCDEV\DOC_FUNCTIONS\../classes/classlcDocTKit_item.asp, line 52
> >
> > However I have no idea why, it is a dictionary object and not a
> > recordset, the object should still be open.
> >
> > Any help is greatly appreciated.
> >
> > Thanks