Error 501 Illegal Assignment - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners) +--- Thread: Error 501 Illegal Assignment (/Thread-Error-501-Illegal-Assignment) |
Error 501 Illegal Assignment - vijayendra.shukla - 04-19-2012 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) Please let me know if you would need more information. Thanks in advance for your help! RE: Error 501 Illegal Assignment - Ankesh - 04-20-2012 Does the function returns some value? Regards, Ankesh RE: Error 501 Illegal Assignment - vijayendra.shukla - 04-20-2012 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. RE: Error 501 Illegal Assignment - Ankesh - 04-23-2012 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. |