Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Check to see if tables exist
Message
From
16/04/2000 20:08:05
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Check to see if tables exist
Miscellaneous
Thread ID:
00360207
Message ID:
00360207
Views:
53
Is there a way to check to see that the tables in the DE exist before the form loads?

I call the following from the Load to set the relative path to the tables. What has me baffled is that the views seem to be referenced just like a table is so if I try to do a FILE(...) it fails because it is not a physical table.
* Make a list of all the cursors in the Data Environment
= AMEMBERS(laObjectList,ThisForm.DATAENVIRONMENT,1)
=ASORT(laObjectList, 2)

* Plug in our data path
IF ASCAN(laObjectList, "Object") > 0
  nStartpos=ASUBSCRIPT(laObjectList, ASCAN(laObjectList, "Object"),1)
  FOR I = nStartpos TO ALEN(laObjectList,1)
    IF laObjectList(I,2) = "Object"
      cObjClass = "ThisForm.DATAENVIRONMENT." + laObjectList(I,1)+".class"
      IF EVALUATE(cObjClass)="Cursor"
        cObjName="ThisForm.DATAENVIRONMENT." ;
          + laObjectList(I,1)+".DATABASE"
        Data_Name=EVALUATE(cObjName)
        NewDataPath = ThisForm.cDataPath + '\' + ALLTRIM(SUBSTR(Data_Name, RAT("\",Data_Name)+1))
        oRef = EVALUATE( "ThisForm.DATAENVIRONMENT."+laObjectList(I,1) )
        *Modify the Database property with the new path
        oRef.DATABASE = NewDataPath
      ENDIF
    ELSE
      EXIT
    ENDIF
  ENDFOR
ENDIF
Next
Reply
Map
View

Click here to load this message in the networking platform