Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Anil Sharma
  Where is Anil Sharma?
 ludhiana
 India
 Anil Sharma
 To: Pete Sass
  Where is Pete Sass?
 Marathon, Ontario
 Canada
 Pete Sass
 Tags
Subject: RE: open files in the data environment
Thread ID: 331091 Message ID: 331102 # Views: 39 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Forms
Date: Monday, December 26, 2011 8:26:11 PM         
   


> > Somewhere in the program i close all database and files and i change the database to historic database.before I want to reopen the file in the data environment of the form.
> > How to do that?
> > thanks in advance.
>
>
> Hi,
> Not sure how you are making your changes, but certainly you would want to make the targeted database change globally within your VFP project.
> Probably the easiest way is to have the databases with tables and CDX's in of course different folders. Then all you need to do is it ensure your forms and reports point to the selected database folder location.
> This I accomplish with the following code in the form's DA Properties "BeforeOpenTables" event:
>
>
Local cSetCursor
> cSetCursor = pNetPath
> FOR EACH lo IN THIS.Objects
>    IF lo.BaseClass = 'Cursor' AND !ISBLANK(lo.Database)
>       lo.Database = cSetCursor + JustFname(lo.Database)
>    ENDIF
> ENDFOR

>
> Where the value of pNetPath is the folder target to the database you want to access. You put this same code in the DA of all reports so they will target a different database folder location. You can hold several database targeted folder locations in _screen properties and load them up in something like a dropdown picklist. Changing the value of pNetPath changes globally where your entire system points to in accessing data.
>
> You do have to unload the form and reload it for the targeted database location to be changed.
>
> Pete "the IceMan", from the Great White North of Canada.
> www.marathongriffincomputers.com

Hi Pete we can achieve same with single line

THISFORM.SetAll("DATABASE",'C:\yourdbc.DBC','CURSOR')



Anil


Accounting Software

Web Development

Accounting, Inventory, Hotel Management, Restaurant Kot Billing, MLM, Excise Accounting and much much more!.
My Blog

ENTIRE THREAD

open files in the data environment Posted by Carlos Lima @ 12/26/2011 6:33:58 PM
RE: open files in the data environment Posted by Pete Sass @ 12/26/2011 7:51:06 PM
RE: open files in the data environment Posted by Anil Sharma @ 12/26/2011 8:26:11 PM
RE: open files in the data environment Posted by Pete Sass @ 12/27/2011 2:06:54 AM
RE: open files in the data environment Posted by Anil Sharma @ 12/27/2011 4:27:34 AM
RE: open files in the data environment Posted by Pete Sass @ 12/27/2011 2:57:49 PM
RE: open files in the data environment Posted by Cetin Basoz @ 12/27/2011 3:46:48 PM