I had something similar happen. Took me hours to try and figure out why my code wasn't working. Finally, out of desperation, I changed my variable name and it worked. When I finally figured out why, it was because I had done some cutting and pasting and a temp table had a field that started with "lc" instead of "c" like it normally would, and therefore was the same as my variable. Argh! I was about ready to throw my laptop out the window. :)
Michelle
>I had a very strange situation happen to me the other day, and while I've corrected it, I'm wondering if anyone else has run into teh same thing. It appears to be a bug in VFP - I'm using VFP6 with SP5.
>
>I have a function that I've been using for a long time that pulls information out of a string by position between delimiters. The signature looks like this:
>
>* Function to return a value from a text string by position
>FUNCTION fGetVal
>LPARAMETERS cLine, cPos, cType, nLen, nDec, cDelim
>* cLine - the line that contains the required info
>* cPos - the position number in the line of the data required
>* cType - the type that the data will have to match
>* nLen - number of characters to bring back - ignored if not type 'C'
>* nDec - the number of decimals, defaults to 0
>* cDelim - character that separates the fields - defaults to a comma
>
>This function has been working fine for a long time, but suddenly in one project, it didn't. It was returning an empty string when it should not have been.
>
>When I stepped through it in the debugger I discovered that even though I was sending it the correct arguments, it was taking the 'cType' parameter value from a field called cType in the view that was current at the time.
>
>I was doing lcVal = Alltrim(fGetVal(txtString, '5', 'C', 100)) - nDec and cDelim default if not sent. The 1st 4 arguments are required.
>
>In the debugger, the value of the Parameter 'cType' was 'Sample ', which was the content of the cType field in the view in the current workarea.
>
>The fix was simple - changing the parameter name or changing the field name worked equally well. I opted for changing the field name in this case.
>
>Has anyone else run into this scary little bug?
>
>Alan
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only