break points to find out why it doesn't compact or copy

J

Janis

I have this compact script which successfully runs. The script is in a
module in the front-end db and it compacts the back-end db while the file is
closed. I keep getting the "compact successful" dialogue box at the end of
it running but I don't see any movement in the folder or the db being
compacted. I don't see the copy file manipulations. How can I set some
debug variables or break points so I can get some useful informaiton?
Thank you very much,

----
Option Explicit
Option Compare Database
Public Sub compact()


Dim strMsg
Dim objscript
Dim dbe
Set dbe = CreateObject("dao.dbengine.36")
'Me.dbe = CreateObject("dao.dbengine.36")
'path is to System.mdb because it is a split database
dbe.SystemDB = "Z:\SwimClub\System.mdw"
dbe.DefaultUser = "Brian"
dbe.DefaultPassword = "Kiyote#3"

On Error GoTo 0
'perform db compact of backend mdb into a temp mdb first
'if there is a problem the origial mdb is preserved
dbe.CompactDatabase "Z:\SwimClub\acsc_be.mdb",
"Z:\SwimClub\temp_acsc_be.mdb", , , ";pwd=Kiyote#3"


If (Err.Number <> 0) Then
On Error GoTo 0
' There was an error. Inform the user and halt execution
strMsg = "The following error was encountered while compactingdatabase:"
strMsg = strMsg & vbCrLf & vbCrLf & Err.Description
Call MsgBox(strMsg)
objscript.Quit
End If
On Error GoTo 0

' Create File System Object to handle file manipulations
Set objscript = CreateObject("Scripting.FileSystemObject")

' Back up the original file as Filename.mdbz. In case of undetermined
' error, it can be recovered by simply removing the terminating "z".
objscript.CopyFile "Z:\SwimClub\acsc_be.mdb", "Z:\SwimClub\acsc_be.mdb" &
"z", True

' Copy the compacted mdb by into the original file name
objscript.CopyFile "Z:\SwimClub\temp_acsc_be.mdb",
"Z:\SwimClub\acsc_be.mdb", True

' We are finished with TempDB. Kill it.
objscript.DeleteFile "Z:\SwimClub\temp_acsc_be.mdb"
Call MsgBox("compact successful")



End Sub
 
J

Janis

I found the answer myself. It appears the script is working but the
filesystem was creating hidden files so I couldn't see anything happening. I
uncheckd the hidden folder option in control panel and now I can see my
script working.
 
G

Guest

What is the easiest way to transfer data from my home computer to
my netbook?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top