Link to home
Start Free TrialLog in
Avatar of formadmirer
formadmirerFlag for United States of America

asked on

Move DBFs from one DB to another

Hello all. I'm trying to move dbfs from one database to another. I thought this would be simple, but it's really stumping me.

Here's the latest I've tried:

lcCurrentDB = pData + "olddb"
lcNewDB = pData + "newdb"

OPEN DATABASE (lcCurrentDB) SHARED

SET DATABASE TO (lcCurrentDB)
lcName = "item_type"
lcTableName = pData + lcName
IF USED(lcTableName)
	USE IN ('lcTableName')
ENDIF
REMOVE TABLE (lcTableName)
SET DATABASE TO (lcNewDB)
ADD TABLE (lcTableName)

Open in new window


My idea was to simply iterate all my tables (about 20) through a block like above to remove them from the old db and associate them with the new.

I know I'm probably not approaching this correct in the code above.

Something that may be causing additional problems is the fact that this is necessary due to a program name change.

I thought to change the name all I would need to do was rename the .exe, the project files and the db, which I did through Windows Explorer, then recompiled.

Later I realized this might not have been the best approach, and I've been trying to move these tables to the newly named DB since.

Finally, I copied the old DB files back and they now reside in the same directory as the new (renamed) DB files.

I do have complete backups so if I've totally messed things up just let me know and I'll restore and start again.

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of Olaf Doschke
Olaf Doschke
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of formadmirer

ASKER

I have been working on this non-stop for about 5 hours. You should see the conglomeration of "code" I've been building and building in an attempt to get this done.

Did as you suggested - copies db to new location, added to project, renamed via project manager, and in two minutes it's done and everything is working great.
Thank you so much!