Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to globally change the name of a table
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00365405
Message ID:
00365532
Views:
22
>I have one table that MUST change its name in the database.
>What would be the easiest way to change the reference to that table in all the forms and reports ?
>
>thanks
>eric

Open the SCX and FRX as a table and do something like the following:
lnRetVal = adir(aForms, "*.SCX")
for j = 1 to lnRetVal
    lcForm = aForms(j,1)
    use (lcForm) excl
    set filter to "OLDNAME" $upper(methods)
    locate
    if !eof()
       browse
    endif
    set filter to "OLDNAME" $upper(properties)
    locate
    if !eof()
       browse
    endif
    use
    compile form (lcForm)
endfor
return
Note that I do not automatically use code to do a STRTRAN() on the old name to the new name. What if old name is not used as a reference to that table and should not be changed? In the browse you can look at the code yourself and use the Search/Replace to selectively change the references yourself.

From the above example, you can do something similar with reports.
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform