Tom
It's nowt to do with the _TALLY. It's the comment line, where I commented out an older bit of code, with the ";" continuation at the end. So "lnRecCount = _TALLY" was being taken as a continuation of the comment line. Hence, lnRecCount never got instantiated.
>Sergey;
>
>I have been accused of over commenting my code. Luckily, I have not been bitten by this and learned a good lesson! I estimate I have at least a thousand VFP methods I have created using _TALLY after a select statement. I guess I am lucky! :)
>
>Tom
>
>
>
>>Hi Terry,
>>
>>Are you sure that code that fails is exactly the same? Maybe it looks more like following?
...
>> into Cursor csrNewRESUs NOFILTER
>>* Comment ;
>>lnRecCount = _TALLY
>>If lnRecCount > 0
>>...
>>
>>>Curious problem I've never come across before. Consider the code below (an example as a very similar error occured in a similar piece):
>>>
>>>
>>>Select *, RTE_NO + GEN + DIRECTN + STR( ESU_ID, 11) ;
>>> from mclMPSer!ROUTE_ESU ;
>>> where RTE_NO + GEN + DIRECTN + STR( ESU_ID, 11) not in ;
>>> ( Select Rte_No + Gen + Directn + STR( ESU_ID, 11) ;
>>> from RouteESUMap) ;
>>> into Cursor csrNewRESUs NOFILTER
>>>
>>>lnRecCount = _TALLY
>>>If lnRecCount > 0
>>> Wait WINDOW "Updating GIS RouteESUMap table with new Route-ESUs from mPlan ..." NOWAIT NOCLEAR
>>> Select csrNewRESUs
>>> ...
>>>
>>>
>>>When it gets to the line
If lnRecCount > 0 it crashes with the old:
>>>
>>>"operator/operand type mismatch" error.
>>>
>>>So I halt it and inspect in debug. I find, of course, _TALLY is 0 or an integer (depending on which example), but lnRecCount is .F. How can this be when the previous line has equated lnRecCount with _Tally!!! ?
>>>
>>>Now the first time it happened, I thought it a strange anomoly, and I equated the 2 values in the command window. Then I let the form run on, and the code below it worked OK, but it did exactly the same at the above code.
>>>
>>>'ppreciate it
>>>
>>>
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.