Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Object is not contained in a form
Message
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Title:
Object is not contained in a form
Miscellaneous
Thread ID:
00249780
Message ID:
00249780
Views:
67
I have code that ensures that each form's data environment contains the data from the same folder as the .EXE (and not the data in my development folder). I put this in the .Load of two different form classes:
SET TALK OFF
oChangeDataPath = CREATEOBJECT('datafolder')
oForm = THISFORM
oChangeDataPath.curfolder(oForm)
RELEASE oChangeDataPath
RELEASE oForm
That gets changed if the form is in a formset, which it isn't at the moment. My dataenvironment.AutoOpenTables = .F. for every form. The .curfolder method of my datafolder object looks like this:
PARA oFormcalled
* This class resets the paths of tables in the data environment
* to CURDIR()
IF PARAMETERS() = 0
   RETURN
ENDIF
IF TYPE("oFormcalled.DataEnvironment") = "O"
   oEnviron = oFormcalled.DataEnvironment
ELSE
   RETURN
ENDIF
IF TYPE("oEnviron") = "O"
   nTotMem = AMEMBERS(aMems,oEnviron,2)
   WITH oEnviron
      IF .AutoOpenTables = .F.   && which it should be
* Check for cursors
         FOR i = 1 TO m.nTotMem
            IF UPPER(EVAL("."+aMems[m.i]+".BaseClass")) = "CURSOR"
               WITH EVAL("."+aMems[m.i])
* Get the current path of the database
                  STORE .Database TO cDB
                  cDB = SUBSTR(cDB,RAT('\',cDB)+1)
.Database = SUBSTR(FULLPATH(cDB),1,RAT('\',FULLPATH(cDB)))+cDB
               ENDWITH
            ENDIF
         ENDFOR
         .OpenTables()   && the error occurs on this line
      ENDIF
   ENDWITH
ENDIF
RELEASE oEnviron
The error mentioned in the title occurs at the .OpenTables() line, but only if I go into the form, out and into another form, then back into the first form once or twice. It may be relevant that one of the forms that is opened has a private data session. The "Object is not contained in a form" is really error 1938: Object is not contained in a (name). It doesn't seem relevant to this bit of code.
Reply
Map
View

Click here to load this message in the networking platform