>>What sort of safety do you want?
>>
>>In general, if you see that you need to do the same thing over and over again, it seems a good idea to create a function or method, as you did here.
>>
>>If you use an object instead, you can save yourself the trouble of closing the table in code: the table is closed in the class'es Destroy() event.
>
>Hilmar,
>
>This is only true if the class has (or is) a private datasession (or if the class is part of a dataenvironment that closes the tables). Otherwise, the tables will stay open.
No: what I meant is that you create an object (or class) to open a table. The object remembers the name of the alias, and closes it, when the corresponding variable goes out of scope. Thus, after doing this programming once, in the "Table_Open" class, you save yourself the table closing later.
All this isn't required when you have a private datasession, since the tables are closed automatically, anyway.
Let me illustrate:
Function SomeProcess
local loTableObject
loTableObject = CreateObject("cTableObject", TableName, Index, Alias, Buffering, etc.)
...
Further processing here
...
EndFunc
Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)