Password / Username in shortcut to mdb file

Cosmos75

Registered User.
Local time
Today, 01:56
Joined
Apr 22, 2002
Messages
1,281
Is there a way to add the username and password to a shortcut to an Access database?

I know this isn't a smart thing to do (understatement) but I still want to know if it is possible.
 
This will work if you manually edit the target field of a shortcut...

"C:\Program Files\Microsoft Office\Office\msaccess.exe" /wrkgrp "X:\WorkgroupFile.mdw" "Y:\Database.mdb" /user UserName /pwd Password

Another great usage is to quickly repair and compact a db just by clicking a shortcut.

"C:\Program Files\Microsoft Office\Office\msaccess.exe" /wrkgrp "X:\WorkgroupFile.mdw" "Y:\Database.mdb" /user UserName /pwd Password /excl /repair /compact

I prefer to use the Shell function to open a secured db with VBA so that the users do not have a clue as to what the password is and also where the db is.

Call Shell("C:\Program Files\Microsoft Office\Office\msaccess.exe /runtime /wrkgrp X:\WorkgroupFile.mdw Y:\Database.mdb /user UserName /pwd Password", vbNormalFocus)
 
ghudson,
Thank you!
:)
 
Just a quick one....
Where do you call the Shell cmd from ? I would have thought that to open a Db you would have to supply the user name and password first :confused:

Dave
 
Oldsoftboss said:
Just a quick one....
Where do you call the Shell cmd from ? I would have thought that to open a Db you would have to supply the user name and password first :confused:

Dave
You can call if from any application [Access, Excel, VB, etc.] that uses the shell command. It is just like using a custom shortcut like I have posted above. It bypasses the Access login screen if you are using true Access security. Since my code is protected I do not have to worry about the user discovering the login name and password that is needed to remotely open or compact the db. I only use the "user" switch for when I need to automate opening the db with the user login and password. Since they already know it, no worries.

Also, the order of the /switches does not seem to matter in the target string.
 

Users who are viewing this thread

Back
Top Bottom