Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing Data Table Location of a View
Message
From
18/10/1998 11:17:20
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00147871
Message ID:
00147939
Views:
30
>>>I am using a view in a form: v_test
>>>The view is a local view in a dbc called: test
>>>The table is called test.dbf and is in a folder called c:\test\01
>>>
>>>So the SQL for the view is:
>>> SELECT * FROM test!test
>>>
>>>I want to be able to use the same view against the same table located in folder c:\test\02. In other words, multiple sets of data.
>>>
>>>The cursorsource of the DE is v_test.
>>>
>>>How do I change the table location in the DBC to be:
>>> c:\test\02 instead of c:\test\01
>>>
>>>Any ideas?
>>
>>AFAIK, you cannot do this using the same view. You probably want to create a second view pointing at the second set of data...
>>
>>but perhaps I could use a little more background on why you are trying to do this...
>
>
>Erik:
>
>It is an accounting system.
>Each folder would be the books for a different company.
>I want to use remote views for the connection to SQL Server.
>I want to use local views for Fox.
>I want to be able to use the same forms for connecting to both SQL and Fox.
>
>The database tables would be identical in Fox, just stored in different folders.

You should probably have a different dbc for each company; different dbcs with identical views pointing to different data. You can use the same form to access different sets of structurally identical (or similar enough) data.
To do this, all you need is a routine that runs from the BeforeOpenTables event of your dataenvironment that loops through the cursors in the DE and changes their Database property according to what dataset you want to use. Local, Remote, whatever, the form doesn't care. Let me know if you would like some code that does the database switching for you.
Erik Moore
Clientelligence
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform