Compact backend error (1 Viewer)

Local time
Tomorrow, 01:18
Joined
Dec 2, 2011
Messages
26
Hi,

I tried a the following code to compact my backend file from frontend file and I got good result, but when i put a database password into my backend file, it replied "Not a valid password".

Code:
============
Private Sub cmdCompactDatabase_Click()
Dim Response As VbMsgBoxResult
Dim strFullDBName As String
Dim strFullDBNameNew As String

Prompt the user for compacting the back-end database
Response = MsgBox("Do you want to compact Database?", _
vbQuestion + vbYesNo, _
c_strAppTitle)
If Response = vbYes Then
'Determine the fullname of the database and compact the database
strFullDBName = CurrentProject.Path & "\Data.Mdb"
strFullDBNameNew = left(strFullDBName, Len(strFullDBName) - 4) & "_New.mdb"
Application.Screen.MousePointer = 11
DBEngine.CompactDatabase strFullDBName, strFullDBNameNew

With New FileSystemObject
'Delete the current databasefile
.DeleteFile strFullDBName, True
'Rename the new file to the name of the "old" database file
Name strFullDBNameNew As strFullDBName
End With
Application.Screen.MousePointer = 0
End If
End Sub
============

can you suggest me to make it possible with fixed database password in backend file.

many thanks.
 

Users who are viewing this thread

Top Bottom