>I have two directories named \App1 and \App2 (Two Identical Projects). Both have sub-directories named \Files, \Forms, \Prgs and \Temp. Both re-use forms under the directory \GenForms. My problem is that, for example, I made a form under \App1 and used tables under its data environment from \App1\Files, when I re-use and run the same form under \App2, because the tables used for the data environment was in \App1\Files, data shown is also based from \App1. What I do is that I rename the \Files directory under \App1 so that my setpath.prg will work when I test and debug the application. Is there a better way to do this?
If you're going to have generic forms that open tables from multiple directories then you may want to add some pre-processing to the form's dataenvironment. You could store the path to a global/private variable or you could store it to an application object property (if you don't already). Given that you have access to the path, you could put code in the BeforeOpenTables method of the dataenvironment.
for lxx = 1 to amembers(lacursor,THIS,2)
lcname = "THIS."+lacursor[lxx]
lotemp = eval(lcname)
if vartype(lotemp) = "O" and upper(lotemp.BaseClass) = "CURSOR" then
lotemp.Database = mynewpath+"\mydbc.dbc"
endif
endfor
Then the OpenTables method should process everything normally using the App2 data.
Larry Miller
MCSD
LWMiller3@verizon.netAccumulate learning by study, understand what you learn by questioning. -- Mingjiao