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

Wrong number of Arguments or Invalid Properies - Please Help!

Status
Not open for further replies.
May 13, 2008
24
US
Hello all,

I keep getting a message saying that I am passing the wrong amount of arguments or have invalid properties. COuld someone please look at this code and tell me what I have done wrong? It looks good to me, but that is probably a large amount of the reason why I can't find the error. :)

Code:
<%
ErrorFound = False

strSQL = "UPDATE tblStudentContacts SET "

Function StrBuild(FieldName)
if(Request.Form(FieldName) <> "") then
  VarName = Request.Form(FieldName)
  strBuild =  FieldName + " = '" + Replace(VarName, "'", "''") + "', "
EXIT FUNCTION
END IF

'Check to make sure parent is legal guardian
  Parent = Left(FieldName, 3) 
If Request.Form(Parent & "Guard") = "Yes" Then

'Check to see if field is a phone number or email
  If FieldName <> Parent & "HomePh" OR FieldName <> Parent & "WorkPh" OR FieldName <> Parent & "CellPh" OR FieldName  <> Parent & "Email" THEN 

strBuild = "^ERROR^"

EXIT FUNCTION
End IF
End IF

  strBuild = "MoveOn"

End Function


rsFldName.MoveFirst
While NOT rsFldName.EOF
FieldName = rsFldName.fields.item("Parents").value
StrBuild(FieldName)

If StrBuild = "^ERROR^" THEN
ErrorFound = True  
End If

If StrBuild <> "^ERROR^" or StrBuild <> "MoveOn" Then
StrSQL = StrSQL & StrBuild
End If

rsFldName.MoveNext
Wend

'close out the rs
rsFldName.Close()
Set rsFldName = Nothing

'Trim of the Comma Space
StrLen = Len(StrSQL) - 2
StrSQL = Left(StrSQL, StrLen)
StrSQL = StrSQL & "WHERE StuID = " & Request.Form("StuID") & ";"

This is driving me nuts! I am fairly new at vbscript and have only written very very simple functions before.

I appreciate all the help I can get. Thanks so much!!!

-JP
 
<%
ErrorFound = False

strSQL = "UPDATE tblStudentContacts SET "

Function StrBuild(FieldName)
if(Request.Form(FieldName) <> "") then
VarName = Request.Form(FieldName)
strBuild = FieldName + " = '" + Replace(VarName, "'", "''") + "', "
EXIT FUNCTION
END IF

'Check to make sure parent is legal guardian
Parent = Left(FieldName, 3)
If Request.Form(Parent & "Guard") = "Yes" Then

'Check to see if field is a phone number or email
If FieldName <> Parent & "HomePh" [!]And[/!] FieldName <> Parent & "WorkPh" [!]And[/!] FieldName <> Parent & "CellPh" [!]And[/!] FieldName <> Parent & "Email" THEN

strBuild = "^ERROR^"

EXIT FUNCTION
End IF
End IF

strBuild = "MoveOn"

End Function


rsFldName.MoveFirst
While NOT rsFldName.EOF
FieldName = rsFldName.fields.item("Parents").value
[!]myVar =[/!] StrBuild(FieldName)

If [!]myVar [/!]= "^ERROR^" THEN
ErrorFound = True
End If

If [!]myVar [/!]<> "^ERROR^" [!]And myVar [/!]<> "MoveOn" Then
StrSQL = StrSQL & [!]myVar[/!]
End If

rsFldName.MoveNext
Wend

'close out the rs
rsFldName.Close()
Set rsFldName = Nothing

'Trim of the Comma Space
StrLen = Len(StrSQL) - 2
StrSQL = Left(StrSQL, StrLen)
StrSQL = StrSQL & "WHERE StuID = " & Request.Form("StuID") & ";"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hey,

Thanks so much. Funny thing is that I finally got ahold of my mother (my personal coding assistant) and she gave me some tips and I have been playing around with it for the last hour and finally got it to work! Then I check your script and it is exactly what I figured out.

Also, you have helped me many times before. I really appreciate it. Thanks again!

-JP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top