Passing Dictionary object byref

R

Ryan Malone

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
 
R

Ray at

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
 
R

Ryan Malone

Hi Ray

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,225
Members
46,815
Latest member
treekmostly22

Latest Threads

Top