Yes, craig, in case you want to use a table exclusive, that is a catch.
The error here is not because of exclusive use of a file, simply because of double use with different alias names as in
Code:
*somewhere beforehand
USE labels.dbf ALIAS arbry SHARED
* code failing because of file used:
If !Used("labels")
USE labels IN 0 SHARED
Endif
This results in ERROR 3, not ERROR 1705.
By the way, Saif, AUSED() with the file name parameter is not a solution or replacement for USED with alias, because the code following the use in most cases will depend on that alias and if you find out the table you want to open with that alias is already open with another alias, you still are not able to execute the following code as you now need the wrong alias closed and the table opened with the wanted alias. And that will make your directly following code work, but most probably cause trouble where the other alias name is needed.
And if you solve it by
Code:
*somewhere beforehand
USE labels.dbf ALIAS arbry SHARED
* code failing because of file used:
If !Used("labels")
USE labels IN 0 SHARED [b]AGAIN[/b]
Endif
You have the table open twice and may have other unwanted side effects of buffers, etc.
In the end you have to find out why the non default alias is used, where it is used for what reason. There is no one size fits all fix for that with the AGAIN clause and I hope your question about finding the alias causing the USE to fail is all about debugging, not about finding the ultimate simple solution to simply use some table, only when and if needed.
It all gets easier, when working with private datasessions, as that separates the aliases used in a current form and elsewhere in your application.
Bye, Olaf.