Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Type mismatch on accessing an array

Status
Not open for further replies.

habfan

Programmer
Jun 13, 2000
15
CA
I am having an issue where I call a com object that returns an array of values. The function is a variant that returns the error code or array. I can access the isarray, lbound, ubound, and correct vartype (8200). When I attempt to access the actual values I get the error on the page. The code I am using works fine in a VBA solution but I need to move this to an ASP though. Any help would be appreciated.
 
What error do you get? What is the specific line where the error is being thrown?

(In case you haven't done so, in IE be certain to go to Tools->Internet Options and choose the Advanced tab, and uncheck "Show friendly HTTP error messages," so you'll get more detailed errors.)
 
I have http friendly on, the exact message I get is
Microsoft VBScript runtime error '800a000d' type mismatch

The code is

Dim oCustomSecurity
Dim strReturn

Set oCustomSecurity CreateObject("CPMCustomSecurity.Class1")
strReturn = oCustomSecurity.fnGetUserGroup("localhost")
if IsArray(strReturn)
for i = lbound(strReturn) to ubound(strReturn)
k = strReturn(i)
next
endif

it is the line k=strReturn that causes the error. I have checked the return type with vartype and get 8200 which is the expected array of string returned.

Thanks, for any help
 
Thanks,

I have read the post and it does not offer a solution to the issue I am facing though it did give me some ideas. My issue is moving data from com to asp. Which is most likely the same type of issue. So I will pass a string then parse it in the asp page. If anyone knows of a solution to the isses of passing an array from a vb com to an asp page I would like to here from you.

Thanks,

Habfan
 
Yeah, I saw that it went the opposite direction, but didn't see anything out there about going the other way, so hoped it might spark something. Best of luck.
 
Hello habfan,

[1] Check out the ms article 250344 and download arrayconvert.exe:

[2] Out of the extracted file, regsvr32 the ads.dll, after placing it to a desirable folder.

[3] Then use it this way.
[tt]
'if it is not server.createobject
Set oCustomSecurity = CreateObject("CPMCustomSecurity.Class1")
strReturn = oCustomSecurity.fnGetUserGroup("localhost")
set cnvt = createobject("ads.arrayconver")
if IsArray(strReturn) then
strReturn = cnvt.cstrarray(strReturn)
for i = lbound(strReturn) to ubound(strReturn)
k = strReturn(i)
next
endif
[/tt]
regards - tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top