>>>>>use customer in select('customer')
>>>>
>>>>I don't understand. If you're opening a table for the first time you
>>>>
>>>>Use TableName in 0
>>>>
>>>>If you want to know the alias of an already open table you can use: SELECT("TableName")
>>>>
>>>>What you put above will try to open table in the alis that it is already open in, which does not make sense.
>>>
>>>Actually, it does! It will open the new customer cursor in the workarea already occupied by any existing customer cursor OR it will open it in the equivalent of SELECT 0. Although I usually write it like...
>>>
>>>use customer in (select("customer"))
>>
>>Yes I understand this (but his 1st language isn't complex-speak) but, well, what a palarver, rather than just "in 0", unless he actually does want to " open the new customer cursor in the workarea already occupied by any existing customer cursor", which has not been stated as his wish.
>
>Try reading the code as "use the table in the next highest work area unless the table is already open, in which case, reopen the table in its current work area." This is to avoid the "File in Use" error when
USE table IN 0 tries to open a table that's already open. It's an equivalent to
>IF USED('myTable')
> SELECT ('myTable')
>ELSE
> SELECT 0
>ENDIF
>USE myTable
I see. Thanks. Not seen that one. Personally though, I prefer code in "plain English". I don't care for "smartypants" lines of code that have to be studied, interpreted or figured out, A prime example is nested IIF()s, where the arg's are evaluated within as well, rather than writing a few lines of If..Else..Endif.
While I'm at it, I also hate the petty saving had by writing "If !lCondition" rather than "If not lCondition". Often the shriek can be overlooked.
My two penn'orth :-)
- 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.