Echivalent of PACK statement from FoxPro in VB.

I open a Fox database (.dbf) with DAO intrinsec control and use .Delete method
to delete a record, but this can't phisycally delete that record. It just mark it for delete like DELETE statement from FoxPro. What can I do to delete that record like PACK statement (from FoxPro) do ?
boggycAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TimCotteeHead of Software ServicesCommented:
You must actually use the pack statement.

If you add a reference to Microsoft ActiveX data objects (ADO) to your project and add the following code:

    Dim cnnDBF As New ADODB.Connection
    Dim rstDBF As New ADODB.Recordset
    cnnDBF.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;Extended Properties=Driver={Microsoft Visual FoxPro Driver};UID=;SourceDB=u:\;SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;Null=Yes;Deleted=Yes;"
    cnnDBF.Open
    rstDBF.Open "PACK DBF Lots1", cnnDBF
    cnnDBF.Close
    Set rstDBF = Nothing
    Set cnnDBF = Nothing

change the SourceDB section to your path and the Lots1 filename to your file and this will actually pack the .dbf file.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.