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


> >
> >
> > 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


Hi,
First I am interested if you are using the SetAll method for this purpose where are you placing this code in the form events? Since I have never used SetAll for this purpose just wondering. . . normally SetAll would go in the form's INIT event, but you have already loaded the tables in the forms DA prior to things being changed in the INIT event.
Secondly, how do you handle re-pointing reports to the new targeted database container so all report globally prints the data from the new database and tables?
Pete "the IceMan", from the Great White North of Canada.
www.marathongriffincomputers.com

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