mpoincare
January 27th, 2003, 10:25 PM
I am trying to call a function that will generate a reference number
from an ASP Page. Here is the listing of the function:
function ReferenceNumber()
Dim Ref, tmpRef, weightTable
Randomize
Ref = Right(CStr(Day(Now)) & CStr(Month(Now)) & CStr(Second(Now) & CStr(Minute(Now)) & CStr(Year(Now)) & CStr(Int(Rnd * 1000))), 17)
i = Len(Ref)
weightTable = Array(7, 3, 1)
tmpRef = 0
n = 0
Do While i > 0
tmpRef = tmpRef + Mid(Ref, i, 1) * weightTable(n)
i = i - 1
n = n + 1
if n > 2 Then n = 0
Loop
tmpRef = Int(Left(tmpRef, Len(tmpRef) - 1) & "0") + 10 - tmpRef
ReferenceNumber = Ref & Right(tmpRef, 1)
End function
'To call the function: Ref=ReferenceNumber()
Whenever I call that function from an ASP page I get this error
message:
Technical Information (for support personnel)
Error Type:
Microsoft VBScript compilation (0x800A0414)
Cannot use parentheses when calling a Sub
/Plea/English/Invoice.asp, line 32, column 6
CodeC)
-----^
But the routine is not a Sub but a Function.
Can somebody explain me what that statement means in
a context like that and what can be done to fix it.
from an ASP Page. Here is the listing of the function:
function ReferenceNumber()
Dim Ref, tmpRef, weightTable
Randomize
Ref = Right(CStr(Day(Now)) & CStr(Month(Now)) & CStr(Second(Now) & CStr(Minute(Now)) & CStr(Year(Now)) & CStr(Int(Rnd * 1000))), 17)
i = Len(Ref)
weightTable = Array(7, 3, 1)
tmpRef = 0
n = 0
Do While i > 0
tmpRef = tmpRef + Mid(Ref, i, 1) * weightTable(n)
i = i - 1
n = n + 1
if n > 2 Then n = 0
Loop
tmpRef = Int(Left(tmpRef, Len(tmpRef) - 1) & "0") + 10 - tmpRef
ReferenceNumber = Ref & Right(tmpRef, 1)
End function
'To call the function: Ref=ReferenceNumber()
Whenever I call that function from an ASP page I get this error
message:
Technical Information (for support personnel)
Error Type:
Microsoft VBScript compilation (0x800A0414)
Cannot use parentheses when calling a Sub
/Plea/English/Invoice.asp, line 32, column 6
CodeC)
-----^
But the routine is not a Sub but a Function.
Can somebody explain me what that statement means in
a context like that and what can be done to fix it.