This seems pretty straight forward, but I can't get it to
work. I'm mostly interested in the progress meter while
the replicas are being compacted.
I'm running Access 97 with Jet SP3. I have the following
code in a class module called clsCompactor:
Option Compare Database
Option Explicit
Private WithEvents m_jet As TsiCompact.Jet
Public Sub CompactMyDatabase(Source As String, Destination
As String)
Set m_jet = New TsiCompact.Jet
m_jet.SystemDB = "c:\windows\access\mydoc.mdw"
m_jet.UserName = "name"
m_jet.Password = "password"
m_jet.CompactDatabase Source, Destination
End Sub
Private Sub m_jet_BeginCompact()
Debug.Print "Compact has started!"
End Sub
Private Sub m_jet_CompactFailed()
Debug.Print "Compact has failed. :-( "
End Sub
Private Sub m_jet_CompactProgress(UnitsDone As Long,
UnitsTotal As Long, Cancel As Boolean)
Debug.Print "Compact is " & UnitsDone & "/" &
UnitsTotal; " of the way through."
End Sub
Private Sub m_jet_EndCompact()
Debug.Print "Compact has Finished!"
End Sub
This is followed by code behind a button on a form that is
pointing to a database that is currently not in use (for
testing purposes):
Private Sub Compact_Click()
Dim objTSICompact As clsCompactor
Dim strSourceDB As String
Dim strDestDB As String
Dim strDBdir As String
Dim sBackupDir As String
Set objTSICompact = New clsCompactor
sBackupDir = "c:\DeLCom\Backup\"
strDBdir = "c:\DeLCom\"
strSourceDB = strDBdir & "axiom.MDB"
strDestDB = sBackupDir & "axiom.MDB"
MsgBox strSourceDB
MsgBox strDestDB
Call objTSICompact.CompactMyDatabase(strSourceDB,
strDestDB)
Set objTSICompact = Nothing
End Sub
It is not doing anything. I have made sure the .dll is
registered and compiling shows no errors.
Any suggestions?
Mike
Cheval - 18 Nov 2004 21:56 GMT
Two things come to mind immediately.
1) Is this replica farm being managed? If so, then the database could be
being blocked.
2) Have you checked the references to make sure you have the right version
of the TSI installed and referenced?
This seems pretty straight forward, but I can't get it to
work. I'm mostly interested in the progress meter while
the replicas are being compacted.
I'm running Access 97 with Jet SP3. I have the following
code in a class module called clsCompactor:
Option Compare Database
Option Explicit
Private WithEvents m_jet As TsiCompact.Jet
Public Sub CompactMyDatabase(Source As String, Destination
As String)
Set m_jet = New TsiCompact.Jet
m_jet.SystemDB = "c:\windows\access\mydoc.mdw"
m_jet.UserName = "name"
m_jet.Password = "password"
m_jet.CompactDatabase Source, Destination
End Sub
Private Sub m_jet_BeginCompact()
Debug.Print "Compact has started!"
End Sub
Private Sub m_jet_CompactFailed()
Debug.Print "Compact has failed. :-( "
End Sub
Private Sub m_jet_CompactProgress(UnitsDone As Long,
UnitsTotal As Long, Cancel As Boolean)
Debug.Print "Compact is " & UnitsDone & "/" &
UnitsTotal; " of the way through."
End Sub
Private Sub m_jet_EndCompact()
Debug.Print "Compact has Finished!"
End Sub
This is followed by code behind a button on a form that is
pointing to a database that is currently not in use (for
testing purposes):
Private Sub Compact_Click()
Dim objTSICompact As clsCompactor
Dim strSourceDB As String
Dim strDestDB As String
Dim strDBdir As String
Dim sBackupDir As String
Set objTSICompact = New clsCompactor
sBackupDir = "c:\DeLCom\Backup\"
strDBdir = "c:\DeLCom\"
strSourceDB = strDBdir & "axiom.MDB"
strDestDB = sBackupDir & "axiom.MDB"
MsgBox strSourceDB
MsgBox strDestDB
Call objTSICompact.CompactMyDatabase(strSourceDB,
strDestDB)
Set objTSICompact = Nothing
End Sub
It is not doing anything. I have made sure the .dll is
registered and compiling shows no errors.
Any suggestions?
Mike
Michael \(michka\) Kaplan [MS] - 19 Nov 2004 01:08 GMT
Before all that, the zeroeth thing to check:
0) CHECK THE RETURN VALUE OF COMPACTDATABASE -- if it returns False then you
have been old volumes of information, most likely due to #1....

Signature
MichKa [MS]
NLS Collation/Locale/Keyboard Technical Lead
Globalization Infrastructure and Font Technologies
Windows International Division
This posting is provided "AS IS" with
no warranties, and confers no rights.
> Two things come to mind immediately.
> 1) Is this replica farm being managed? If so, then the database could be
[quoted text clipped - 72 lines]
>
> Mike
Mike - 21 Nov 2004 12:38 GMT
The return value returns True. I also made a copy of the
BE and placed it in a directoy by itself - unmanaged.
It still doesn't compact. Any other suggestions?
Mike
>-----Original Message-----
>Before all that, the zeroeth thing to check:
[quoted text clipped - 80 lines]
>
>.
hosammahmoud - 05 Jun 2005 07:20 GMT
when i use access database with password onley not user name it gives to
me access denied to my database
so i want acode to treat database with password onley
not with the user name thx alot
--
hosammahmoud