Protect Access 2016 database with password

Moshe Singer
Moshe Singer used Ask the Experts™
on
I encrypted the database with a password, however, I want to be able to open the database with a command line which should include the password, because I see no other way to protect the application except for using a password. Does anyone have a suggestion how I can include the database password in the command line?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Distinguished Expert 2017

Commented:
If you include the password in the command line, how does that protect the database?
Máté FarkasDatabase Developer and Administrator

Commented:
Yes it is possible to provide the password when you open the database file in Access:

C:\<path to office>\MSACCESS.EXE /pwd <password> YourDatabase.mdb

Open in new window

Moshe Singerdeveloper

Author

Commented:
thanks Mate Farkas
if you try this, you will see that  it is not possible
"pwd" is not working for a "Database Password"


And for PatHartman
the Command line I can close in many ways, it can be a vb project, and some other ways
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Network & Security Engineer / Dev Pro Access
Commented:
May be try to use this code each time to want to open the database.
It is not a command shell one but you can set it on the database and let autoexecute it each time you will open it.
Good luck

Public Sub SetDatabasePasswordRunCmd(strSourcePath As String)

    ' Define Variables
    Dim accApp As New Access.Application
 
    ' Open the Source database in Exclusive mode
    accApp.OpenCurrentDatabase strSourcePath, True
 
    ' Invoke the "Set/Unset Database Password" dialog
    accApp.DoCmd.RunCommand acCmdSetDatabasePassword
 
    ' Cleanup Variables
    accApp.Quit acQuitSaveNone
    Set accApp = Nothing
 
End Sub
Moshe Singerdeveloper

Author

Commented:
how i use to code to Unset Database Password?
Distinguished Expert 2017

Commented:
Try starting a new question.  This one is closed.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial