Avatar of Chayaphad Chokasut
Chayaphad Chokasut
 asked on

How to Reindex a DBF file Using VB6?

I had this question after viewing To Reindex DBF file Using VB6.
I think that the answer to above question is only demonstrate that Microsoft DAO 3.51 Object Library can index database file. However, if an index file is corrupted/damaged, the DAO won't work properly. Normally, I need to fix the damaged index file via "reindex" command using Foxpro. So, I would like to know if there is a way to do the reindex in VB6.

Best Regards
Ming
DatabasesFoxProVisual Basic Classic

Avatar of undefined
Last Comment
Chayaphad Chokasut

8/22/2022 - Mon
John Tsioumpris

I think - since the index file is bad - the way to handle it is to first create an index file and then manipulate it if you want
Check this : http://vbcity.com/forums/t/66952.aspx
Side Note : Dbase format is OLD...maybe you should consider another approach...like transfering your data to another database engine
Chayaphad Chokasut

ASKER
Dear John;

     Thank you for your kind solution. It's very helpful. I can now create new unique indexes by using VB6. However, if a new index is corrupt, do I have to delete it and recreate it again? or can I just directly reindex it in VB6? How could I do those?
     About new database engine, I always want to learn it. If possible, could you kindly provide some articles of new database engine that's compatible with VB6.
     Looking forward to your advices.

Best Regards
Chayaphad
John Tsioumpris

If it's corrupt you can't do much...so delete it and start over.
As for DB engine. VB6 works nicely with pretty much everything..so make your pick.
I reckon that ,based on the dbase background that Access or Sqlite are your best options
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Chayaphad Chokasut

ASKER
Dear John

     Can I delete an index using .execute in VB6?  For example, I can create an unique index with command line
         aDatabase.Execute ("CREATE UNIQUE INDEX anIndexName ON aRecordset(aFieldName);")
     but when try to delete it with command line
         aDatabase.Execute ("DROP UNIQUE INDEX anIndexName ON aRecordset(aFieldName);")
     I got a syntax error. Please kindly help me with the correct syntax.

Best Regards
Ming
ASKER CERTIFIED SOLUTION
Chayaphad Chokasut

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question