Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Key/Index problem 1

Status
Not open for further replies.

jlockley

Technical User
Nov 28, 2001
1,522
US
Using the format/restructure interface on Paradox 10 I cannot change/remove the key or set a secondary index of newrol.db. I receive the message: newrol.db is already in use. This is true with the save AND the save as options.

What I want to do is to make a combination of fields, namely name, position and location, the key, so that I can add John Smith catering director at the Hilton Santa Fe when I have a John Smith Executive Chef at Nona's Pizza and a John Smith Executive Chef at the Ritz.

1) Have I got the right idea here?

2) Why can't I do it?

Many Thanks. Jo Lynne


 
Additional note. Remembering earlier problems in changing the key field, I copied the db and mb files to another folder. While the error message did not repeat this time, the "not enough disk space" message did. Temp directory is on a drive with about 7 gb free. Moving the db is the method I found earlier worked for precisely this problem.
 
Jo Lynne,

There are a couple of possibilities:

1) The error may be honest; that is, Restructure needs exclusive access to the target table. It cannot be in use by anyone or anything. If the table is in use, you need to close it.

2) If you're sure the table isn't in use, then it may actually still be in use. There are a couple of ways to test this:

a) Try choose Window | Close All. You'll need to reopen the project viewer, but it works for most common cases.

b) If Window | Close All doesn't resolve the problem, then
try changing the working directory to a different directory and then change back to the current working directory.

Note: If you use the Project Viewer to do this, make *sure* you click the Set Current Directory button. (I usually use File | Working Directory, as I tend to forget to click that button.)

If you can resturcture the table now, that suggests that you've got something that opens the table earlier, but doesn't close it properly.

If that seems like what's happening, look for places where you use the table in a tCursor and make *certain* you manually close the TCursor.

Why? Although the docs suggest that TCursors automatically close when they go out of scope, I've see cases where that doesn't happen. It's more prevelant in older versions (e.g Paradox 5, 7.16, and 7.32), but I've seen cases in later versions.

In my experience, it's best to always close your Tcursors manually. A good way to do this is to add something at the bottom of your method in each event that uses a TCursor:

Code:
if tc.isAssigned() then
   tc.close()
endIf

BTW, this is why you'll see stuff like that in almost all my ObjectPAL code for the last several years. It's a habit I forced myself to get into precisely because I would run into strange problems and this was one way to make them stop.

Now, it is possible that setting the working directory may not close all resources (such as a hidden form) because you can add code to forms that keeps them open when the user changes directories. (See for details).

If you're still having the problem after changing working directories, try the following:

1. Exit Paradox.

2. Add the following options to the Target of your Paradox shortcut: -nec

3. Restart Paradox. Notice that it opens completely blank. That's what those options do. (See for details.)

4. Try restructuring your table.

If it still fails, then either the table or the key may be corrupted. In this event, manually delete the indexes, rebuild the table, and then recreate your indexes.

That's pretty much a core dump of the various things that may be getting in the way. If it still doesn't work, then it's time to sacrifice a chicken to remove the voodoo curse. :))

Hope it helps...

-- Lance
 
Jo Lynne,

Out of curiosity, which one was it?

Thanks in advance...

-- Lance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top