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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disconnecting dBase indexes?

Status
Not open for further replies.

Phydos

Programmer
Oct 5, 2002
16
0
0
GB
I currently link to dBase tables using MS-Access, however, I need to disconnect the dBase indexes before doing this (using dBStructure as I don’t have a licensed copy of dBase). Is there a way to remove the index and disconnect them using either VBA or Access (or any other method)?

Thank you,
Phydos music & media
phydos-music.gif

 
It's either version 4 or 5 - it's actually a DOS application with dBase files.
 
set the mdxbyte to 00h Christopher F. Neumann
[dBASE Charter Member]
Blue Star Visual dBASE graduate
ICCP certified TCP/IP Network Analyst
 
dBaseIV uses "production index files" that get created automatically when a datafile is created (.dbf file). It has the same name as the datafile and an extension .MDX. The datafile has a flag in it's header indicating that the production index exists. This will automatically open that production index file. Sounds like that's what you're running into. (Single index files and independent multiple index files have to be explicitly opened.)

If the DOS app needs to continue to use the index file, I'm not sure there's a way around the index. If the app is something you're abandoning/converting and thus don't need the index file in the long run, I'd be tempted to move the .MDX file to another directory, then hit the database with Access and see what happens - quite possibly an error. If that happens, then I'd open the .DBF in a an editor and see if you can spot the flag for the index file in it's header and change/delete it. I've not done this before, so I'm no help in what the flag is or how it appears in the header.

If it's dBaseV, things may be entirely different - I have no experience with that version - maybe someone more knowledgeable than I will help. There are probably ways of using Visual Basic or other tools to connect to Dbase and ignore the index - I'm just not familiar with them....

Sorry I couldn't be more help. Good luck.

 
Just checked the index files – the extensions are CDX, couldn’t find any flags when I opened them with notepad, just some unusual characters “ à P”, same kind of thing in the DBF file “ q â ”

What I do at the moment is delete all the CDX files, open the DBF files in another application (dBStructure – a free application) and detach all the indexes before linking to the tables in Access (otherwise I get an error) - then re-index later after I’ve extracted all the data. I thought there may have been some sort of exe file that would simply detach all the indexes in one nice clean swoop (which I could then run from VBA)?

Unfortunately, I don’t have a licensed copy of dBase (this is a compiled application built on dBase). Do you know of any other way I can change the flags?

Christopher - thanks again on thread number 2

Thank you,
Phydos
 
CDX? That isn't a dBase table. Probably FoxPro!! Again dBase gets a bad wrap!! Christopher F. Neumann
[dBASE Charter Member]
Blue Star Visual dBASE graduate
ICCP certified TCP/IP Network Analyst
 
I see… I’ll try the FoxPro people. But thanks anyway, it does sound like you were onto something.

Phydos
 
Phydos:

Christopher is correct - .CDX files are FoxPro compound index files (Structural compound index files if they have the same name as the datafile they are associated with). If they are named the same as their datafile, they will (as with dBase) open automatically when the datafile is opened.

If you are able to re-create the indexes in dbStructure, do you use a command like "Index On To" or "Reindex"? Because if it has the capability to execute dBase commands, then try :

Use MyTable
Set Index To

This will open the data table and turn off any indexes. Otherwise, the structural index files are auto-opened by an association establed within the foxpro database itself and you will not be able to easily dissociate it. But if you search the FoxPro forum, you will likely find some folks who've accomplished this.

By the way, why do you want to turn off the indexing to begin with? Is it a filtered index so that you're not getting all the records you need?
 
I don’t mind the fact that the files are indexed, just that it is causing problems when I link to the database from Access – basically, I need to get all the data out of the tables, and this is the only way I’ve managed it so far.

Unfortunately, it’s the application itself which rebuilds the indexes rather than dbStructure – so I have no way to pass commands. But I will have a look around the web for some other utilities now that I have your advice.

I’ll also see what the FoxPro guys have to say. Thanks,

Phydos
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top