Bytes (byValdbFileName, byValDbVer, byValSavePath) Compressed database file 0 is access971 is access2000OnErrorresumenextIfRight (SavePath, 1) OrRight (SavePat
Set Ca = Nothing CreateDBfile = True End If End function Public function CompactDatabase (byVal dbFileName, byVal DbVer, byVal SavePath) compressed database file 0 is access 97 1 is access 2000 On Error resume next If Right (SavePath, 1) Or Right (SavePat
Set Ca = Nothing
CreateDBfile = True
End If
End function
Public function CompactDatabase (byVal dbFileName, byVal DbVer, byVal SavePath)
'CompressionDatabaseFile
'0 is access 97
'1 is access 2000.
On Error resume next
If Right (SavePath, 1) <> "" Or Right (SavePath, 1) <> "/" Then SavePath = Trim (SavePath )&""
If Left (dbFileName, 1) = "" Or Left (dbFileName, 1) = "/" Then dbFileName = Trim (Mid (dbFileName, 2, Len (dbFileName )))
If DbExists (SavePath & dbFileName) Then
Response. Write ("sorry, thisDatabaseAlready exists! ")
CompactDatabase = False
Else
Dim Cd
Set Cd = Server. CreateObject ("JRO. JetEngine ")
If Err. number <> 0 Then
Response. Write ("NoCompression, Please check the error message
"& Err. number &"
"& Err. Description)
Err. Clear
Exit function
End If
If DbVer = 0 Then
Call Cd. CompactDatabase ("Provider = Microsoft. Jet. OLEDB.3.51; Data Source =" & SavePath & dbFileName, "Provider = Microsoft. Jet. OLEDB.3.51; Data
Source = "& SavePath & dbFileName &". bak. mdb; Jet OLEDB; Encrypt Database = True ")
Else
Call Cd. CompactDatabase ("Provider = Microsoft. Jet. OLEDB.4.0; Data Source = "&
SavePath & dbFileName, "Provider = Microsoft. Jet. OLEDB.4.0; Data Source = "&
SavePath & dbFileName & ". bak. mdb; Jet OLEDB; Encrypt Database = True ")
End If
'Delete the oldDatabaseFile
Call DeleteFile (SavePath & dbFileName)
'ConvertCompressionAfterDatabaseFile Restoration
Call RenameFile (SavePath & dbFileName & ". bak. mdb", SavePath & dbFileName)
Set Cd = False
CompactDatabase = True
End If