Yes, mmerlin has answered that. I also already said you better don't use specific work areas, because in the long run, if you want to combine several PRGs you can't use a certain workarea twice. Opening tables in a specific workarea letter or number is bad because of that. You always have the alias name with or without using the ALIAS clause of use, the workarea has a name, which is much easier to understand than a letter or number, it makes code better readable, understandable, maintainable, even after years of not looking into it.
I recommend to not use the ALIAS clause, unless you need a table open twice, not using it you get the table name as alias name, as long as the DBF file doesn't start with a digit and does not contain spaces. You can use more than the pure latin 26 letters, but I recommend not to. Just using the 26 letters, underscores and only using digits at the end of a name makes it a perfect table and alias name. USE tablename.dbf IN 0 then results the table to be opened in an unused workarea (that also means, it doesn't close any table) with the name (more exact the stem name = file name without path and DBF extension) of the dbf file and code working on alias=table name is easy to understand, extend, etc.
Just as a side note: USE is not only a command opening a table, it also closes tables. USE without any further options, names, etc simply closes what is open in the current workarea. Not specifyind IN 0 or IN a, IN 1, etc, USE works in the currently selected workarea. That means the following code opens and closes tables, in the end only table3 is open in the current workarea:
Code:
USE table1
USE table2
USE table3
In contrast the following code opens the three tables in whatever free workareas available:
Code:
USE table1 IN 0
USE table2 IN 0
USE table3 IN 0
0 is not a workarea number, 00 is telling VFP to use the next free workarea, therefore this doesn't tr to open the three tables in the same workarea, which would close previous opened tables like the first example.
Also notice: If you already have run code openeing other tables and then afterwards run the last code with IN 0, the three tables are opened without close any previously opened table. You're more flexible with this, as you don't depend on the free slots. You don't hard wire the workarea numbers this way. You still have alias names = table names you can always refer to. SELECT table2 selects the workarea having table2 opened in it, no matter if that's workarea 2 or 6 or 300 because other workareas are already used. If you think of workareas as slots, making use of the specific nature of 0 is, you let VFP manage workarea numbers, you don't need to take care of it. Doing your programs with different relations in that manner, you can run several of them, you only need two or three monitors to display all browse window you need and then can have multiple relations. The only thing you need to take care of is specifying alternate alias names for tables you need to open more than once, because alias names need to be unique to not get an ambiguous alias name.
If still don't understand, that will come later. Just do it that way and you won't get into trouble. Just don't forget you need to address the workareas by the table names then, not by a,b,c or 1,2,3.
Bye, Olaf.