>I have a Visual 3.0 app which uses a DBC in the Data Environment in the main tabbed form. I also want to be able to export records to another DBC, same name different sub-directory and also access those records using the same tabbed form. When I close the first DBC and open the second DBC, the forms appear to still be using the first DBC.
>What's up? Thanks for your help.
They are using the same because the path to the DBC is stored with the tables and views in your DE. I have a PRG that I run that will open the SCX as a table and strip these paths from all the cursors in the form DE. The code is verbose, but I don't care. I wanted to make dang sure I did not screw up the form. You will probably want to test this on a copy of a SCX/SCT until you are comfortable with it.
set talk off
set deleted on
local lnRetVal, i, j, lcFile, llFound, lcStr, lcPath
local array laFiles(1,2)
cd forms
lnRetVal = adir(laFiles, "*.scx")
for i = 1 to lnRetVal
lcFile = laFiles(i,1)
use (lcFile) excl
locate for "DATABASE" $upper(Properties)
do while !eof()
llFound = .f.
for j = 1 to memlines(properties)
if alltrim(upper(substr(mline(properties, j), 1, 8))) = "DATABASE"
llFound = .t.
exit
endif
next
if llFound
lcStr = mline(properties, j)
lcStr = alltrim(substr(lcStr, 11))
lcPath = justpath(lcStr)
lcPath = addbs(lcPath)
replace next 1 properties with strtran(properties, lcPath, "")
endif
continue
enddo
pack
use
compile form (lcFile)
next
cd ..
Mark McCasland
Midlothian, TX USA