Joe
Fri Apr 29 05:34:21 CDT 2005
Hi,
"SQLReporter" <SQLReporter@discussions.microsoft.com> wrote in message
news:324AA5E4-C07B-41FA-9A7D-528376F1AD55@microsoft.com...
> Thanks for response.
> When I tried that i got following error.
> "Type Mismatch" on the same line..
> I found similar question at
http://forums.devshed.com/t54920/s.html
> but can't find answer :(
> Any thoughts?
>
> "Joe Earnest" wrote:
>
>> Hi,
>>
>> "SQLReporter" <SQLReporter@discussions.microsoft.com> wrote in message
>> news:EFECC98A-034B-4EAF-B799-E59808A687E9@microsoft.com...
>> > hi ,
>> > I have written a follwing script :
>> >
>> > Dim i,j,ub
>> > ub = ubound(evnt.replacementParameters)
>> >
>> > For i=0 to ub
>> >
>> > j = evnt.replacementParameters(i)
>> > .............
>> > .............
>> > Next
>> >
>> > Where evnt.replacementParameters is an array of strings.
>> > When debugging I can see upper bound as 3 and lower bound as 0.
>> > But I am getting error at statement,
>> > j = evnt.replacementParameters(i)
>> >
>> > which says "Wrong Number of properties or invalid property assignment "
>> > with
>> > err.number = 450.
>> >
>> > I am not able to find what's going wrong!!?
>> > While debugging , Watch for evnt.replacementParameters shows me all the
>> > four
>> > values in that array,
>> > but watch for evnt.replacementParameters(0) and
>> > evnt.replacementParameters(1)
>> > shows empty!!!
>> >
>> > Any help would be appreciated.
>> > Thanks in advance.
>> >
>> Try this --
>>
>> Assuming evnt is an object and replacementParameters is a return array
>> property, assign the array to a script array before articulating the
>> elements. Array property returns cannot generally be handled in the same
>> manner as collection returns.
>>
>> Dim a,i,j,ub
>> a= evnt.replacementParameters
>> ub = ubound(a)
>>
>> For i=0 to ub
>> j = a(i)
>> .............
>> .............
>> Next
>>
>> Joe Earnest
>>
I believe that you've taken care of your first problem and moved on to a new
and different one.
I am at a disadvantage, without knowing what the object does or returns.
The error is occurring on the "j=a(i)" line, right? Do you know if you're
getting the error on your first iteration through the loop (element 0) or a
later one? Once a is assigned, have you tested it for array status with a
"0" lbound?
Whenever you're confused by a type mismatch error, put in a test line to see
what you've got. The problem could be on the left or right side. If you
formally dim or redim j as an array somewhere in your code, you may get this
error when you try to reset it to a scalar value. Another issue could be
that you're treating a as an array when it's not. If a(i) is an object, it
may require "set j= a(i)". Otherwise, VBS variables are all variant
subtypes and should reassign without problem. But more likely you're
getting the value issue from your object.
Try ...
...
msgbox typename(a)
msgbox isarray(a) & vbCr & lbound(a) & vnCr & ubound(a)
For i=0 to ub
msgbox typename(a(i)) & vbCr & isobject(a(i))
j = a(i)
...
Joe Earnest