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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array of Objects (ERROR!)

Status
Not open for further replies.

link9

Programmer
Nov 28, 2000
3,387
US
Hi --

I'm trying to create an array of objects. The number of objects needed varies from request to request, and so I assumed this would be the most efficient way to accomplish this. However, I'm getting a error that doesn't add up to me, seeing that the method I'm trying to call is explicitly a function, and not a sub(which is what the error calls it)? Anyway, take a look and post if you can help.

Class declaration excerpt:
Code:
class topThreeBox

    public currentN, previousN
    public currentTop, previousTop

    public function calcTop3Box(rs, strFieldName, intUpperBound, intLowerBound, intUpperValid, intLowerValid, strCurOrPrev)

***meat of function here***

        end function
end class


Declaration of array:
Code:
dim i, intNumOfQuestions
for i = 2 to 13
    if formObjectArray(i) then
        intNumOfQuestions = intNumOfQuestions + 1
    end if
next
dim topBoxArray(intNumOfQuestions)
set topBoxArray = new topThreeBox


Trying to call the aforementioned method:
Code:
topBoxArray(intTopSpot).calcTop3Box(currentRS, "Q1", 10, 1, 10, 8, "current")

Resulting Error Message:
Microsoft VBScript compilation error '800a0414'

Cannot use parentheses when calling a Sub

/heclientrg2000/calculateConcessions.inc, line 9

topBoxArray(intTopSpot).calcTop3Box(currentRS, "Q1", 10, 1, 10, 8, "current")


Thanks in advance for any help!

Paul Prewett
 
Hi Paul ,
try this one ..
''some variable
dim xyz
xyz=topBoxArray(intTopSpot).calcTop3Box(currentRS, "Q1", 10, 1, 10, 8, "current")
inplace of
topBoxArray(intTopSpot).calcTop3Box(currentRS, "Q1", 10, 1, 10, 8, "current")
in case of function u have to assign value return by function to some variable otherwise it treat function as sub.so another alternative would be it to use call like this ..
call topBoxArray(intTopSpot).calcTop3Box(currentRS, "Q1", 10, 1, 10, 8, "current")

I hope this will soleve your problem.
anil.




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top