Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Error 1152 - Cannot access selected table
Message
 
À
27/07/2001 10:56:01
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00536423
Message ID:
00536817
Vues:
11
>I know that this error is probably being caused when a combobox's or listbox's rowsource is a SQL query, and the query is re-run without the RowSource being temporarily set to "". Problem is that the error seems to be occurring somewhere in VFP's innards, so it is not being trapped by our error handler. Is there any way of forcing this error into our error handler?
>
>--Peter Silverman, Insurance Data Processing

Peter,

My apps have been plagued with these errors from time to time. Your explanation of what happens is right. What I do now, in Codebook, is make sure to kill all such objects before releasing the dataenvironment. Never seen the problem again.
*-- ReleaseDataEnvironment()
*-- CHANGE - JCM - November 17, 2000 - 21:29:30
*-- Have a cleaner appearance
IF thisform.LockScreen = .F.
  thisform.LockScreen = .T.
ENDIF
 
THISFORM.KillClassObject( 'CIFVIEWCOMBOBOX', THIS)
*-- CHANGE - JCM - November 17, 2000 - 21:29:13
*-- son de la misma raza...
THISFORM.KillClassObject( 'CIFCOMBOBOX', THIS)
 
*** EGL: 3/27/98 - Changed this to a more direct test
** IF TYPE("This.oDataEnvironment") == "O" AND !ISNULL(This.oDataEnvironment)
IF TYPE("This.oDataEnvironment.Name") == "C"
  This.oDataEnvironment.Release()
ENDIF
 
RETURN
*---
*---------------------- Location Section ----------------------
*  Library...........:
*  Class.............: Cbaseform
*  Method............:
*-------------------------- Copyright -------------------------
*  Author............: José Constant
*  Project...........: SOAS
*  Created...........: 17/11/2000  21:50:09
*  Copyright.........: (c) Constant Software Systems , 2000
*  Compiler..........: Visual FoxPro 06.00.8862.00 for Windows
*----------------------- Usage Section ------------------------
*) Description.......: Kills a control based on its class.
*                    : Based on the FindControlSourceObject by Doug Hennig, modified by Bernhart Milcent and
*                    : Claudio Daniel Campos
*                    : Uses recursion to kill every control included in container objects
*                    : Usefull for pesky objects like cifCombos and their siblings that produce the unfamous
*                    : 'Cannot access selected table' error message.
*  Scope.............:
*  Parameters........:
*$ Usage.............:
*% Example...........:
*  Returns...........:
*------------------- Maintenance Section ----------------------
*@ Inputs:...........:
*  Outputs...........:
*  Pre-condt. invar..:
*  Post-condt.invar..:
*? Notes.............: None
*  Collab.methods....: None
*--Process...........:
*  Change log........:
*--------------------------------------------------------------
 
LPARAMETERS tcClass, ;
  toObject
 
LOCAL loContainer, ;
  lcField, ;
  laMembers[1], ;
  lcObject, ;
  loObject, ;
  lcClass, ;
  lcBaseClass
 
* If we were passed a container, use it. Otherwise, use the form as the
* container to drill down into.
 
loContainer = IIF(pcount() = 1, THIS, toObject)
lcClass = UPPER(tcClass)
 
*-- CHANGE - JCM - November 17, 2000 - 20:24:05
*-- If the control is an ActiveX, return a .NULL.
*-- Otherwise we'd get an error
IF UPPER( toObject.CLASS) # "OLECONTROL"
  * Get a list of members in the container, then check each one.
 
  AMEMBERS(laMembers, loContainer, 2)
 
  *-- This line added by Bernhart Milcent
  IF TYPE("laMembers[1]") = "C"
 
    FOR EACH lcObject IN laMembers
 
      loObject = EVALUATE('loContainer.' + lcObject)
      lcBaseClass  = UPPER(loObject.BASECLASS)
 
      DO CASE
 
        CASE UPPER(loObject.PARENTCLASS) == lcClass
          *-- kill it
          loObject.RELEASE
          loObject = .NULL.
 
          * For container classes, call ourselves recursively so we drill down into the
          * container.
        CASE lcBaseClass $ 'PAGE,PAGEFRAME,CONTAINER,GRID,OPTIONGROUP, COLUMN'
          THIS.KillClassObject(tcClass, loObject)
        OTHERWISE
          *-- nothing
      ENDCASE
 
    NEXT loObject
  ENDIF
ENDIF
RETURN
José
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform