access| Data | database | compression | Online while working on Builddb/buildapp on-line Demo, I developed a little function that would compact Access Databases over the web. Here's a "no-frills" page that's ll compact the databases for you.
One problem with Access databases was that "holes" are created when records are, deleted the database making and fluffy Ated. Compacting the database makes it lean and efficient again.
Note:this Function/page can easily is combined with the Buildapp front end file navigation and search pages (installment II), to create a application that ' ll make it easy to handle this formerly troublesome chore for all the databases on your Machine/web site.
++++++++++++ Begin compact.asp +++++++++++++++++++++++++++++
<%
Option Explicit
Const jet_3x = 4
Function Compactdb (DBPath, BOOLIS97)
Dim FSO, Engine, Strdbpath
Strdbpath = Left (Dbpath,instrrev (DBPath, "\"))
Set fso = CreateObject ("Scripting.FileSystemObject")
If FSO. FileExists (DBPath) Then
Set Engine = CreateObject ("JRO. JetEngine ")
If boolIs97 = "True" Then
Engine.compactdatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & DBPath, _
"Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & Strdbpath & "Temp.mdb" _
& "Jet oledb:engine type=" & jet_3x
Else
Engine.compactdatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & DBPath, _
"Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & Strdbpath & "Temp.mdb"
End If
Fso. CopyFile Strdbpath & "Temp.mdb", DBPath
Fso. DeleteFile (Strdbpath & "Temp.mdb")
Set FSO = Nothing
Set Engine = Nothing
COMPACTDB = "Your database," & DBPath & ", has been compacted" & VbCrLf
Else
COMPACTDB = "The database name or path has not been found. Try Again "& vbCrLf
End If
End Function
%>
<H2 align= "center" > Compacting an Access database<p align= "center" >
<form action=compact.asp>
Enter relative path to the database, including database name.<br><br>
<input type= "text" name= "DBPath" ><br><br>
<input type= "checkbox" Name= "boolIs97" value= "True" > Check if Access to the database
<br><i> (default is Access) </i><br><br>
<input type= "Submit" >
<form>
<br><br>
<%
Dim dbpath,boolis97
DBPath = Request ("DBPath")
BOOLIS97 = Request ("BOOLIS97")
If dbpath <> "" Then
DBPath = Server.MapPath (DBPath)
Response.Write (Compactdb (DBPATH,BOOLIS97))
End If
%>
</p></body>
++++++++++++ End Code