Compacting an Access 97 Database with VB6

L

lappy

Hello, I have written a small programme to compact an access 97
database.
Dim je As New JRO.JetEngine

' Compacts database Data.Mdb to Data2.mdb.
je.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data
Source=C:\Dump\DataOld.Mdb", _
"Provider=Microsoft.Jet.OLEDB.4.0;" & "Data
Source=C:\Dump\Data.Mdb"

I have tried running the code on a number of different databases and
it works fine. The code as been run in debug mode and as an exe file
without any problems. I then ran the code on another database but it
does not complete and errors up with: You do not have the necessary
permissions to use the '' object. Have your system administrator or
the person who created this object establish the appropriate
permissions for you.
Does anybody know why. Is it possibly to do with security. If I
Compact the database from Access manually it works fine. If I use code
in access and run the code from a makro, when the database with the
code in it opens, it also works successfully. The above code works on
all other databases. I have a feeling that there is some security
issue can anybody shed any light on this problem? Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top