Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error 501 Illegal Assignment
#1
Solved: 10 Years, 8 Months, 3 Weeks ago
Hi guys,

I am having tough time figuring out what's wrong with the function call. I have a function which i am calling and the moment it enters the function i get the err.number = 501.

I verified all the variables, all are string and it matches with the number of arguments defined in the function.

No clue why am I getting this.

this is my function call statement:

Code:
Action_Result = fnAccountInfoPageOSA(iInitialDeposit, sFundAccFrom, sAccNickname, sChangeOwnerToJoint, sASPOption, sASPAmount, sASPAccFrom, sASPFreq, sASPStartDate)

and this is how its been defined in the function lib:

Code:
Function fnAccountInfoPageOSA(iInitialDeposit, sFundAccFrom, sAccNickname, sChangeOwnerToJoint, sASPOption, sASPAmount, sASPAccFrom, sASPFreq, sASPStartDate)

' code to be executed

End Function

Please let me know if you would need more information. Thanks in advance for your help!
Reply
#2
Solved: 10 Years, 8 Months, 3 Weeks ago
Does the function returns some value?

Regards,
Ankesh
Reply
#3
Solved: 10 Years, 8 Months, 3 Weeks ago
luckily i could figure it out but its very strange the way QTP behaves in some situations.

In my function library, one of the function I copied from another library and renamed it but while returning the value of that function, it was the old function name. Once i fixed that i didnt see this error. But its pretty strange that while I had not fixed that error, QTP did not throw error while calling other functions but this. If someone could explain that behavior it would be great.
Reply
#4
Solved: 10 Years, 8 Months, 3 Weeks ago
The error that u were getting was because u were assigning a value to the variable..

Code:
Action_Result = fnAccountInfoPageOSA(iInitialDeposit, sFundAccFrom, sAccNickname, sChangeOwnerToJoint, sASPOption, sASPAmount, sASPAccFrom, sASPFreq, sASPStartDate)

But there was no value being returned by the function. Hnece no value was getting assigned and QTP was throwing error.

In function we were not getting any error because u were doing a assignment using wrong name. This name was being treated as a variable by QTP. Hence no error.


Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Wrong number of arguments or invalid property assignment qtpro_exe 0 6,284 11-22-2011, 07:48 AM
Last Post: qtpro_exe

Forum Jump:


Users browsing this thread: 1 Guest(s)