Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Change data path after compile form
Message
From
12/01/2001 22:04:38
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
11/01/2001 02:42:00
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00462065
Message ID:
00463316
Views:
16
>First turn AutoOpenTables in your DE to .F.
>
>Add this code like this to the Load() event of your form (you could put this in a class so you don't need to remember to put it in every form):

Alternatively, I'm doing it from the .Dataenvironment.BeforeOpenTables, like this:

oApp.SetDataEnv(this)
dodefault()

The second line is optional - there's no parent class code to execute, it's more a reminder that the default behavior will occur after this.

I had to do this because of a funny bug, which occurs almost regularly. I have forms which I copy across clients; now when I open the form for editing, the local client's data show up, but at runtime I'm observing (in the debugger, but couple of attempts to log the behavior confirmed it) that it's opening the tables from the directory where it was originally designed. Specifically, if the path (for a form stored in y:\firstuser\app\forms) to a .dbc or .dbf is ..\data, and in the PEM window I do see the path is now y:\seconduser\app\data, it's still opening the tables from y:\firstuser\app\data.

I'm wondering why is this happening. If I open the first user's form from VFP and do a SaveAs to the local Forms directory, it recomputes the paths to the original directory, and there's no way short of hacking to fix that. Therefore I copy the form as files, but it still keeps the original location's fullpath somewhere. I don't have the problem once this is deployed, since the user has a different directory structure and surely can't find these alien tables, but testing is sometimes totally baffling - seeing someone else's data instead the ones you just browsed.

It may have something to do with projects - replacing a file with a file from another project doesn't give you the "the project has been moved" message and subsequent recalculation of paths. Could this be just a gotcha?

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform