Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Error loading the data environment
Message
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Miscellaneous
Thread ID:
00189248
Message ID:
00198924
Views:
18
Here is code that we add and we customize to specify the right path for the cursor used in the dataenvironment.
In the BeforeOpenTable of your dataenvironment you could add and customize this code. Note oParameter.hpath. is a public object where we keep our environment variables.

I hope it could help.

LOCAL lbUseDataEnv
LOCAL nTotMem
LOCAL laMems
LOCAL i
LOCAL DBF_PARENT, NOM_CURSOR
DIMENSION laMems[100,1]

lbUseDataEnv = (TYPE("THISFORM.DataEnvironment") = "O")
IF lbUseDataEnv
nTotMem = AMEMBERS(laMems,THISFORM.DATAENVIRONMENT,2)
WITH THISFORM.DATAENVIRONMENT
* Check for cursors
FOR i = 1 TO nTotMem
IF UPPER(EVAL("."+laMems[i]+".BaseClass")) = "CURSOR"
NOM_CURSOR = laMems(i)
DBF_PARENT = .&NOM_CURSOR..DATABASE && Guarda el nombre de la dbc
DBF_PARENT = SUBSTR(DBF_PARENT,RATC("\",DBF_PARENT) + 1) && Le quita el directorio

IF NOT EMPTY(DBF_PARENT) AND FILE(oParameter.hpath.sDatapath + DBF_PARENT)
.&NOM_CURSOR..DATABASE =oParameter.hpath.sDatapath + DBF_PARENT && Le indica la dbc sin path, para que tome el path actual.
ENDIF
IF NOT EMPTY(DBF_PARENT) AND FILE(oParameter.hpath.sDatapath + "Standard\" + DBF_PARENT)
.&NOM_CURSOR..DATABASE = oParameter.hpath.sDatapath + "Standard\" + DBF_PARENT && Le indica la dbc sin path, para que tome el path actual.
ENDIF
IF NOT EMPTY(DBF_PARENT) AND FILE(oParameter.hpath.sDatapath + "Toolbar\" + DBF_PARENT)
.&NOM_CURSOR..DATABASE = oParameter.hpath.sDatapath + "Toolbar\" + DBF_PARENT && Le indica la dbc sin path, para que tome el path actual.
ENDIF
IF NOT EMPTY(DBF_PARENT) AND FILE(oParameter.hpath.sDatapath + "Treeview\" + DBF_PARENT)
.&NOM_CURSOR..DATABASE = oParameter.hpath.sDatapath + "Treeview\" + DBF_PARENT && Le indica la dbc sin path, para que tome el path actual.
ENDIF

ENDIF
ENDFOR
ENDWITH
ENDIF


>I am having the same problem. My application directory is \MMortals\TestApp\. I want to develop so that the ErrorLog is on a shared network drive.
>
>I put Errorlog.dbf in \MMortals\TestData, where my TestApp.DBC is. It works fine if Errorlog.dbf is the application directory.
>
>But if I move ErrorLog.DBF to \MMortals\TestData\, I get "Error instantiating cursor object. Cannot find \MMortals\TestApp\Errorlog.dbf".
>
>I believe the problem is in the SET PATH of SETUP.PRG. ErrorLog.DBF is not in that path and goApp does not exist yet to find the local DBC location. The other problem is that ErrorLog.DBf is a free table, so it does not use the DefaultDatabase path. Any ideas how fix this??
Analystik Team
1430 Belanger
Montreal (Quebec)
Canada
(514) 278-2727
analyste@analystik.ca
Previous
Reply
Map
View

Click here to load this message in the networking platform