Sample Code Needed to Compress a MS Access file from code in a VB 6 program 
Author Message
 Sample Code Needed to Compress a MS Access file from code in a VB 6 program

I tried using the DBEngine.CompactDatabase command but I don't seem to be
able to get this working.
There must be alot of people that has a working example of this, and can
give me a working code sample.

Thanks for your help....



Wed, 18 Jun 1902 08:00:00 GMT  
 Sample Code Needed to Compress a MS Access file from code in a VB 6 program


Quote:
> I tried using the DBEngine.CompactDatabase command but I don't seem to be
> able to get this working.
> There must be alot of people that has a working example of this, and can
> give me a working code sample.

> Thanks for your help....

I have seen a few bits of code on www.planetsourcecode.com


Wed, 18 Jun 1902 08:00:00 GMT  
 Sample Code Needed to Compress a MS Access file from code in a VB 6 program

Quote:

>I tried using the DBEngine.CompactDatabase command but I don't seem to be
>able to get this working.
>There must be alot of people that has a working example of this, and can
>give me a working code sample.

>Thanks for your help....

Using DAO, I think this will work...

''' Compacts an Access Database
Sub CompactDB(strOrigDB As String)

    On Local Error GoTo CompactDB_Error

    ''' Compacts DB and replaces to same file
    Dim strTempDB As String

    strTempDB = App.Path & "\temp_db.zzz"
    DBEngine.CompactDatabase strOrigDB, strTempDB

    FileCopy strTempDB, strOrigDB
    Kill App.Path & "\temp_db.*"

CompactDB_Error:

    Exit Sub

End Sub

Not sure how it would be dnoe with ADO though???  Anyone?

--------------
Progressive Data Solutions
http://www.pdsolutions.com.au
Home of VB Code Cutter - VB/VBA Code Library & Development Tool



Wed, 18 Jun 1902 08:00:00 GMT  
 Sample Code Needed to Compress a MS Access file from code in a VB 6 program
Hi Karl

This was the topic of a Series of posts about a week ago, Someones
located this article which outlines the process of how to do it with
extensions to ADO,

Quote:
> http://support.microsoft.com/support/kb/articles/Q230/5/01.ASP

HTH

--
-Dick Christoph

http://www1.minn.net/~dchristo

Quote:

> I tried using the DBEngine.CompactDatabase command but I don't seem to be
> able to get this working.
> There must be alot of people that has a working example of this, and can
> give me a working code sample.

> Thanks for your help....



Wed, 18 Jun 1902 08:00:00 GMT  
 Sample Code Needed to Compress a MS Access file from code in a VB 6 program
Also, make sure the db is closed b4 compacting to
avoid err#3196.

http://www.cartoonexpress.com/glynn
Quote:


>>I tried using the DBEngine.CompactDatabase command but I don't seem to be
>>able to get this working.
>>There must be alot of people that has a working example of this, and can
>>give me a working code sample.

>>Thanks for your help....

>Using DAO, I think this will work...

>''' Compacts an Access Database
>Sub CompactDB(strOrigDB As String)

>    On Local Error GoTo CompactDB_Error

>    ''' Compacts DB and replaces to same file
>    Dim strTempDB As String

>    strTempDB = App.Path & "\temp_db.zzz"
>    DBEngine.CompactDatabase strOrigDB, strTempDB

>    FileCopy strTempDB, strOrigDB
>    Kill App.Path & "\temp_db.*"

>CompactDB_Error:

>    Exit Sub

>End Sub

>Not sure how it would be dnoe with ADO though???  Anyone?

>--------------
>Progressive Data Solutions
>http://www.pdsolutions.com.au
>Home of VB Code Cutter - VB/VBA Code Library & Development Tool



Wed, 18 Jun 1902 08:00:00 GMT  
 Sample Code Needed to Compress a MS Access file from code in a VB 6 program


Wed, 18 Jun 1902 08:00:00 GMT  
 Sample Code Needed to Compress a MS Access file from code in a VB 6 program
Check out this article at vb-world:
http://www.vb-world.net/databases/tip482.html


Wed, 18 Jun 1902 08:00:00 GMT  
 Sample Code Needed to Compress a MS Access file from code in a VB 6 program


Wed, 18 Jun 1902 08:00:00 GMT  
 Sample Code Needed to Compress a MS Access file from code in a VB 6 program
Thanks for the previous input, I tried both method.
This works fine for Northwind.mdb but when I try this
on my own access file I get "Reserved error (-1038)         (??? i don't
know what this means)
I tried repairing the file, but it does not go away.
I will keep trying to get this working and if I discover what the problem
was I will post
what the problem was.


Quote:
> I tried using the DBEngine.CompactDatabase command but I don't seem to be
> able to get this working.
> There must be alot of people that has a working example of this, and can
> give me a working code sample.

> Thanks for your help....



Wed, 18 Jun 1902 08:00:00 GMT  
 Sample Code Needed to Compress a MS Access file from code in a VB 6 program
Follow up to this problem.

I got the code working fine using Northwind.mdb but it would not work on my
access file (keept getting Reserved error (-1038). I started to create new
test access files and the compress code worked ok. I created another access
file and exported all tables and recreated all table relations ships and now
the compress works OK. There should not be any difference in the two access
files, but obviously there are some problems that you can't do a access
database repair on!


Quote:
> Thanks for the previous input, I tried both method.
> This works fine for Northwind.mdb but when I try this
> on my own access file I get "Reserved error (-1038)         (??? i don't
> know what this means)
> I tried repairing the file, but it does not go away.
> I will keep trying to get this working and if I discover what the problem
> was I will post
> what the problem was.



> > I tried using the DBEngine.CompactDatabase command but I don't seem to
be
> > able to get this working.
> > There must be alot of people that has a working example of this, and can
> > give me a working code sample.

> > Thanks for your help....



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. Compressing Access files from within VB code

2. VB code samples needed for FTP transfer program

3. Sample of MS Access operation coding

4. VB and MS Access - need code

5. VB sample code using MS XML Parser?

6. Need sample code for read public folder contact into access

7. any sample code of Arithmetic Coding in VB?

8. Need sample code for data access

9. question on using Access database - need sample code

10. question on using Access database - need sample code

11. Sample email program source code in VB !

12. Sample email program source code in VB !

 

 
Powered by phpBB® Forum Software