Here is an xdialog that renames a db. Of course, you need to be in another db than the one you wish to rename in order to use it.
Function download for easy A5 import below. Code here:
Function download for easy A5 import below. Code here:
Code:
'Date Created: 18-Feb-2008 03:53:51 PM 'Last Updated: 20-Nov-2008 10:38:43 AM 'Created By : PG 'Updated By : PG FUNCTION f_db_rename AS L (vSource="" AS C, vTarget="" AS C ) 'Rename a database DIM SHARED vSource as c DIM SHARED vTarget as C DIM SHARED xBox as C ok_button_label = "&OK" cancel_button_label = "&Cancel" xBox = ui_dlg_box("Rename Database",<<%dlg% {region} Select the existing database:| [%p=ui_get_file("Select a database","Database (*.adb)",vSource,"X");I=$a5_smart_file%.50vSource]; Type new name here \(w/o path or ext):| [.50vTarget]; {endregion}; {line=1,0}; {region} <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL> {endregion}; %dlg%) IF xBox = "OK" vPath = FILE.FILENAME_PARSE(vSource,"P") vName = FILE.FILENAME_PARSE(vSource,"N") FILE.RENAME(vSource,vPath + chr(92) + vTarget + ".adb") FILE.RENAME(vPath + chr(92) + vName + ".alb",vPath + chr(92) + vTarget + ".alb") FILE.RENAME(vPath + chr(92) + vName + ".alm",vPath + chr(92) + vTarget + ".alm") FILE.RENAME(vPath + chr(92) + vName + ".alx",vPath + chr(92) + vTarget + ".alx") xMsg =<<%text% Check to see if there are any libraries associated with the old database name. 1. Select File > Database Properties. 2. Display the Libraries tab. 3. Select each library associated with the old database name and click Remove. %text% ok_button_label = "&OK" x = ui_dlg_box("Database Renamed",<<%dlg% {region} |{text=90,6:xMsg}; {endregion}; {line=1,0}; {region} <*15=ok_button_label!OK> {endregion}; %dlg%) f_db_rename = .T. ELSE f_db_rename = .F. END IF END FUNCTION
Comment