This article was previously published under Q130603
This article has been archived. It is offered "as is" and will no longer be updated.
Visual FoxPro uses SET PATH to determine which file opens first whenmultiple files have the same name and no database (.DBC file) is current.This behavior matches the behavior of prior versions of Microsoft FoxPro.
To see this behavior, assume the following directory structure:
C:\MAIN C:\MAIN\ONE C:\MAIN\TWO
Directory MAIN contains two .DBC files (d_one and d_two). Both databasesare open, neither is current.
SET DEFAULT TO C:\MAIN OPEN DATABASE d_one OPEN DATABASE d_two SET DATABASE TO
The d_one database contains a T_ONE.DBF table that resides in C:\MAIN\ONE.The d_two database also contains a T_ONE.DBF table that resides inC:\MAIN\TWO.
Given this scenario, no table is opened if the following command is issued:
This is because the current directory is MAIN where no table named "t_one"resides, and no database container (.DBC file) is current. Visual FoxProlooks for a free table named T_ONE.DBF in the current MAIN directory anddoesn't find one, so it generates this error:
File C:\MAIN\T_ONE.DBF does not exist.
However, if you had used SET PATH to set the path, Visual FoxPro would havelocated the file in which ever directory occurred first. For example:
SET PATH TO C:\MAIN\TWO;C:\MAIN\ONE ** T_ONE.DBF in directory TWO is opened. SET PATH TO C:\MAIN\ONE;C:\MAIN\TWO ** T_ONE.DBF in directory ONE is opened.
To guarantee that a particular table in a database container (.DBC file) isopened, use Visual FoxPro's exclamation (!) symbol notation. For example:
However, if the t_one tables did not belong to a database container (.DBCfile), the exclamation (!) symbol notation could not be used. This behavioris consistent with FoxPro versions 2.x. For tables that don't belong to aVisual FoxPro database, you must use the FoxPro version 2.x method to opena specific table:
USE TWO\t_one && Assumes current directory is C:\MAIN