TmsaUtility Component
A simple component that uses OLEAutomation to Repair and Compress Microsoft Access (MDB) Data Files.
- From Final Filer Software
- (Pierre du Parté)
- http://www.finalfiler.com
- mailto:finalfiler@finalfiler.com
-
- Version 1.000
Top Of Page
OVERVIEW
Repairing & Compacting Access Database is actually a relatively simple matter with Delphi. Nevertheless, I though a component could make the process simpler still. This component DOES NOT use the BDE- it calls the DAO library directly through OLEAutomation.
Apart from the objective functions of repair and compact, the component will
- let you select the file to work on
- return an OLEVariant that is an instance of the DAO.DBEngine object.
It should be straightforward to build other DAO.Engine procedures into the component, hence it’s name ‘TmsaUtility’
If you find this component useful or have suggestions, please send me an email- pierre@finalfiler.com
Enjoy!
Original Release 28/3/1998
Top Of Page
LICENCE: Free!
CONDITIONS OF USE-
GUARANTEES, WARRANTIES ETC.
ABSOLUTELY NONE (what do you want for nothing?).
RESPONSIBILITY:
ABSOLUTELY NONE BY FINAL FILER SOFTWARE!
Use these components entirely at your own risk.
DO NOT USE THESE COMPONENTS IF YOU DO NOT AGREE WITH THE CONDITIONS OF USE!
Copyright
If you respect copyright legislation, then the copyright to these components belongs to Final Filer Software (1998). Feel free to use the component as you see fit, but if you make changes, how about letting the rest of us know?
Top Of Page
THE COMPONENTS:
The Main Components- TmsaUtility
TmsaUtility
The component takes the explicit path and name of an .MDB file and repairs and/ or compresses it. As an aside functions to return the OLEVariant of the DAOEngine have been made public.
NOTE: Compact writes a temporary file that will be the compacted file. Hence there must be available disk space for the task. If compaction succeeds the original is deleted and the new (temporary) file is renamed to that of the original.
Repair & Compact require exclusive access.
PROPERTIES:
Options – A set from which you select the action that will be Carried out when you call EXECUTE (See FLAGS)
MDBFileName – the explicit path and file name
FLAGS:
FmsaRepair – Attempt Repair of the nominated database
FmsaCompact – Attempt to compact the nominated database
FmasRepairCompact – Attempt repair and compaction of the nominated database.
METHODS:
Function SelectMDBFile: Boolean; - Pops up the File Open dialog and let’s the user select an MDB file which is assigned to MDBFilename. The function returns TRUE if a valid selection was made.
Function GetDAO_Object{}:OLEVariant; Returns an instance of the DAO.DBEngine. If the engine is already running the current instance is used, otherwise a new one if created. If you use this don’t forget to free the variable at the end with myOleVariant := Unassigned.
Execute Call this to get the component to do is stuff
Sample:
- procedure TForm1.Button1Click(Sender: TObject);
- begin
// repair and compact
msaUtility.Options := fmsaRepairCompact;
// set the MDBFilename
if msaUtility1.SelectMDBFile then
// if successful, execute the action
msaUtility1.execute;
end;
USING THE COMPONENT:
- 1- Drop the component on a form.
- 2- Set the MDBFilename to the path and name of the MDB file to repair/ compact.
- 3- Select the Option that will determine the action.
- 4- Call Execute!
NOTES:
If you DO NOT specify a MDBFilename, SelectMDBFile is called automatically.
Top Of Page
-
INSTALLATION:
The Component:
- In Delphi 3 Click File|Open
- Select AccessUtility.dpk
- In the subsequent Dialog click Compile
- Click Install
Top Of Page
HISTORY
Version 1.00 released 28/3/1998
Top Of Page