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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alias Not Found

Status
Not open for further replies.

AlanDI1

Programmer
Apr 20, 2003
56
I have an application with a number of forms. The system admin has a form to select the data and software location. That is saved to a table and is accessed when the application starts. At start up time a list of public variables is built concatenting the data location and the table names (this app uses old style DB III tables).

In the data environment of each form I have a cursor for each table to be used. In the "Before Open Tables" Event of the Data Environment I set the CursorSource for each cursor to the appropriate variable with the fully qualified name for the table. If I stop the form in debug the value is set correctly. I then let the tables open automatically and proceed with my processing.

This always worked in VFP 3, 5, 6 and 7. Now in VFP 8 I get a "Alias Not Found" message for the first cursor and then all works fine. That includes all the processing related to the fact that those cursor(s) are supposed to be open. Also, if I open a second form I do not get the error message. The error message does not occur again until I close the app and restart it.

What is different about VFP 8?

Any help would be greatly appreciated. Thanks
 
Thanks Dave. I've been fighting with it some more since I wrote the original thread. It seems to be a specific table that is the problem. If I take that table/cursor out the other 3 work fine. If I remove it totally and put a USE ("filename") IN 0 ALIAS CMSDbf just before I begin processing I get the same message. That message being "Alias 'CMS' is not found". This occurs at the USE statement yet it opens the table with the correct alias and the processing works fine once you click OK to the message.

The table/file opens in VFP 8 (the ENGINEBEHAVIOR did not help). I have tried hard coding the filename (for testing), using the variable and just typing it in the command window. Nothing works for that one table.

I'd settled for a way to stop the message from appearing at this time. Can't get that to work either.

Thanks again
 
I am a little confused. Alias 'CMS' is not found indicates that you are referencing an alias that does not exist in the current datasession...such as you would get if you ran:

SELECT "CMS"
*or*
REPLACE cms.fld WITH "" IN cms

from the command window when no such work area contains a table/cursor opened under the alias "CMS"

I don't understand your use of "CMSDbf" as the alias for the table you are opening - the error indicates that "CMS" is being looked for. There is indeed some code somewhere that is throwing this error...whether it be in one of the DE events, a trigger (unlikely as you seem to indicate that these tables are free tables - but if they are part of a database then there are plenty of places for this code to be), or something. When you step through the code in debug mode line by line, does the error truly come when you issue the USE statement? I don't even see a reference to "CMS" in that statement. Since you are using VFP8 have you done a search for CMS via the "Code References" tool? Could save you a lot of time and trouble looking for this mysterious "CMS" reference that you haven't been able to find.

The problem is that there is no table opened under the alias "CMS" though it is being referenced somewhere in the application. Why you don't get this same behavior in VFP7 and below is a mystery since you seem to have ruled out the only possible cause I could think of that was given by Dave. Perhaps there are differences between these different versions of your app that you are not fully privy to?

You'll need to provide more information and code for this to be properly diagnosed here, it is not an undocumented bug I am quite sure. VFP is telling you exactly what is going on via that error message. "CMS" whatever table/cursor that is an alias for is not opened in the current datasession at the point at which a yet discovered line of code or property reference in a form/control/object/report is interpretted by VFP runtime. Find exactly what is happening when you get the error and you'll know what is happening.

boyd.gif

 
Oh Craig you are worth your weight in gold, now if I can only get the client to pay you for it.

Yes it did truely fail at the USE statement.

Here's the deal. These tables that I am accessing are from a package call MOM (Mail Order Manager) and the client just upgraded to the newest version. That meant a few new fields, field size changes and of course new indices. So I was testing my old reports against the new tables.

Your suggestions about triggers did it. There was a new index in that table that had a reference to CMS.<whatever> instead of just the column name. I took out the reference to CMS and it worked fine.

Thank you, I've spent the whole day being frustated. You are the best.
 
AlanDI1,

Glad to hear you were able to solve that annoying problem. I absolutely hate it when that sort of thing happens and a perfectly good day is wasted.

I am of the mind that all this compartmentalization in most programming languages is not necessarily a good thing. The organization is fine, but when there are so many doors and drawers, one is not always sure which one to look in when trying to find something (take a report throwing a syntax error when there are hundreds of controls on it... double-click them one at a time or at the very best, open the report as a table...heck!). The code reference tool was a great addition to VFP 8 and I hope that MS will continue to add to these types of search utilities in their programming languages... and how about an error message for a report that tells us which one of the fields on the report is throwing the error while they are at it. [smile]

boyd.gif

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top