On The Fly Link -- Password protected

midmented

DP Programmer
Local time
Today, 05:08
Joined
Jun 5, 2008
Messages
94
This is something I put in my database to help a little more with securing my backend data. My front end I made into an mde. I placed a password on the backend mdb file and run a splash screen on startup to "on the fly" link up to the tables. I delete all linked tables when the database frontend closes.
I ran into the problem with users being able to get into the backend datasets. Something I DO NOT want at all.
Anyway, here's the code. I hope it helps someone out there!
Code:
Function PasswordOpen(strTablePathName As String, strTableName As String) As Integer
'Standard Call for opening a password protected backend table
         Dim db2 As DAO.Database
         Dim ws As DAO.Workspace
         Set ws = DBEngine.Workspaces(0)
         Set db2 = ws.OpenDatabase _
         (strTablePathName, _
         False, False, "MS Access;PWD=YourPassword")
         DoCmd.TransferDatabase acLink, "Microsoft Access", strTablePathName, acTable, strTableName, strTableName
         Set ws = Nothing
         Set db2 = Nothing
         
End Function
I use (Example) to call the link table:

Call PasswordOpen("X:\SomeFolder\User.mdb", "tblMyTableName")
 
I'll have to check again, but I'm pretty sure that even MDE will have world-readable strings if opened with a text editor.

For this reason, I prefer to have my users supply the password, then hash it into something else, and use that as backend password.
 

Users who are viewing this thread

Back
Top Bottom