We help IT Professionals succeed at work.

How do I compact and repair a database with a password

Clive Beaton
Clive Beaton asked
on
285 Views
Last Modified: 2014-08-19
I'm trying to compact and repair a password protected database with the following code:

Public Sub Compact()
   Dim CurrentFile As String, BackupFile As String
   On Error GoTo 0
   CurrentFile = "C:\CAV3\Database1.accdb"
   BackupFile = "F:\Database1.accdb"
   If Dir(BackupFile) > "" Then
      Kill BackupFile
   End If
   Application.CompactRepair CurrentFile, BackupFile, True
   Exit Sub
   
End Sub

How do I change it to supply the password?

Thanks in advance.
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2016
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Clive BeatonAccess Developer

Author

Commented:
Perfect.  Thank you.
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.