Hi folks,
I’m working on a relatively simple feature to update some content in a database – a time-stamp, specifically. However, every time I try to make the call, I get the following error:
[code]Microsoft VBScript compilation error ‘800a0414’
Cannot use parentheses when calling a Sub
/datetest.asp, line 31
UpdateContactBK(StrContactNo,ObjTrack,pd(DAY(date()),2) & ” ” & MonthName(2,true) & ” ” & YEAR(date()),”TrainAcc”)
——————————————————————————————————————^
The corresponding code:
[code]
<%
Function pd(n, totalDigits)
if totalDigits > len(n) then
pd = String(totalDigits-len(n),”0″) & n
else
pd = n
end if
End Function
Function returnDateString()
Dim lastAccDate
lastAccDate = pd(DAY(date()),2) & ” ” & MonthName(2,true) & ” ” & YEAR(date())
returnDateString = lastAccDate
End Function
Response.Write(returnDateString())
[color=red]UpdateContactBK(StrContactNo,ObjTrack,returnDateString(),”TrainAcc”)[/color]
%>
As you’ll see, the Response.Write call is perfectly fine, and correctly prints the date in MM-DD-YYYY format. However, the compiler doesn’t seem to like the red line. I’ve read [url]http://blogs.msdn.com/b/ericlippert/archive/2003/09/15/52996.aspx?PageIndex=2#comments
[i] Note: UpdateContactBK method omitted, as it isn’t relevant.
Thanks, all.