# Use VB to compact & repair back-end database?



## maxx_eclipse (May 29, 2007)

Afternoon techies,

I've once again returned with needed help for MS Access 2007.

I've currently reached a stage in the database production that requires me to compact and repair a back-end database from the front-end.

I am aware a similar question was asked back in February, with a reference to this page:

http://www.paulsadowski.com/WSH/compactdbs.htm

However, that coding looks sophisticated and something beyond my understanding. I am aware that there is another code, DBEngine.CompactDatabase, that looks simple enough to use, but I'm wondering if:

a) It is possible to use that for back-end compact and repair?
b) How does it work? How does it read file paths? Syntax usage? (etc.)

Does anyone know anywhere where I might find a guide or online tutorial on how to use it?

I have Visual Studio Express Edition, but it doesn't seem to have that code in their library... I'll try running a more thorough search later.

Looking forward to your replies!


----------



## OBP (Mar 8, 2005)

If you follow the link in the link that you provided you get the simplified version that you will want to use see 
http://support.microsoft.com/default.aspx?scid=KB;en-us;230501


----------



## maxx_eclipse (May 29, 2007)

well, the unfortunate thing for that coding is that it won't find the directory I give.

It doesn't seem to like the directory being used:

"\\DLINK-A5E6FC\Volume_1\DATA_1\DATABACKEND.accdb"

I think it's because it lacks a proper drive letter?

I'll have to tinker around with it next Monday (today is a public holiday). I'll let you know how it goes.


----------



## maxx_eclipse (May 29, 2007)

Well, I believe I solved one part of the problem:

I needed to activate the "Microsoft Jet and Replication Objects (2.1 And Above) library".

Will now have to see how it goes on Monday.

--------------------

But could I ask another question, is there any place where I might find a list of recommended/most used references for VB? I'm interested in getting the full array up and running so I avoid situations like this in future (in the event of misinformation).

I've currently got the following active:

Visual Basics for Applications
Microsoft Office Access 12.0 Object Library
OLE Automation
Microsoft Office 12.0 Access database engine Object Library
Microsoft ActiveX Data Objects 2.1 Library
Microsoft Windows Common Controls 6.0 (SP6)
Microsoft Calendar Control 2007
Microsoft Jet and Replication Objects 2.6 Library

(I assume I should add all Office 12.0 Object libraries, such as PowerPoint, Publisher, Word, etc?)

Would it be possible to start another thread solely related to VB references, and possibly make it a sticky so that future users can utilise the compiled list of references? I think it would be a great and helpful to other users.

--------------------

Furthermore, the employees in my office are using the runtime environment for Access, which means that they don't have the full package of Access nor access to any form of VBA. So would there be any conflict if I give them the software to run on the runtime environment, even though they don't have any VBA application to enable references for the code functionality?


----------



## OBP (Mar 8, 2005)

I think you need to ask a moderator about making it a sticky post, alternatively you could put it on the Access Library or on the "Tech Tips & Tricks" forum.
As to References, as you said Office programs, you didn't mention Excel & Outlook.
You should also consider
FPDTC 1.0 Type Library - for FSO Scripting
AcroIEHelper 1.0 Type Library

Although making them Active when you don't need to can lead to problems for others who have not set them as active, causing "Missing Reference" errors. So I think it wouls be better to just make a note of them and what they do.

Sorry I can't help you with the Runtime versions as I have no experience with Access 2007.


----------



## maxx_eclipse (May 29, 2007)

Thanks again for your help OBP.


----------

