Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trouble finding tables

Status
Not open for further replies.

Octagon6

Programmer
Mar 18, 2003
18
US
when I click on an object that requires info from a table, it comes up with an error [tablename] alias not found; however, when I click ignore, it brings me to a list of tables and I can choose the table from that list.

After that, I don't get errors and the program has no trouble finding the tables, as long as I don't exit out of foxpro and reenter.

What could I do so that the tables can be found all the time?
 
Octagon6

Are your tables in the dataenvironment of the form? If they aren't put them in there and VFP will not go look for them.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Under Tools...Options...File Locations You will find Search Path system variable...add the path to your tables to this and then click on the Set As Default button to make sure that VFP saves this new addition. The reason you don't have anymore problems after you go find the table and open it manually is because that folder that your table was in is now the VFP current directory and it can find anything in its current directory that it needs. So when you exit VFP and come back in then the current directory has most likely be reset to the Visual Foxpro home directory and now it can't find the table(s) again. Mike brings up a good point as well, the dataenvironment of the form is a really good place to open and close tables you need in the form, why not let VFP handle all the details?

Slighthaze = NULL
 
Octagon6,

Keep in mind that VFP is an event-driven environment. When you click on a control, you can't make any assumptions about which table is selected, because you don't know what code was fired immediately before the click.

Be sure always to specifically select the correct table, set the index order, etc.

Mike


Mike Lewis
Edinburgh, Scotland
 
To expand on Mike G's answer, "alias not found" means the table is not open. It must either be in the data environment of the form, or already have been opened prior to calling the form.




Mike Krausnick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top