Gustav Brock
gustav at cactus.dk
Wed Aug 11 10:52:15 CDT 2004
Hi Mark > In A2K I need to relink tables to a password protected db. I don't want the > user to have to enter a password? Any suggestions? At least once, connect to your backend using the correct password. This stores the password in the connect string of the tables. When you wish to relink: 1. Retrieve the connect string from one of the tables. 2. Rebuild the connect string replacing the old path with the new path along the lines of the comments of this function: <code> Public Function DaoTableJetConnect( _ ByVal strConnect As String, _ ByVal strDatabase As String) _ As String ' Builds DAO connect string for attaching a Jet table. ' strConnect is empty for a non-secured database. ' For a password protected database it may look like: ' ' "MS Access;PWD=password;" ' ' strDatabase must be a valid full path filename like: ' ' "F:\Folder\JetFile.mdb" ' ' Result string will be, respectively: ' ' ";DATABASE=F:\Folder\JetFile.mdb" ' "MS Access;PWD=password;;DATABASE=F:\Folder\JetFile.mdb" ' ' 2004-05-04. Cactus Data ApS, CPH. Dim strTdfConnect As String ' No special error handling. On Error Resume Next strTdfConnect = SetConnectKey(strConnect, cstrConnectionKeyDb, strDatabase) DaoTableJetConnect = strTdfConnect End Function </code> The SetConnectKey is a quite convoluted function which will be overkill here but essentially it performs string manipulation to build the new result string as shown. (Look for "DATABASE=" and replace until next semicolon or end of string). 3. Relink the tables using the revised connect string. This way your password resides in the connect string of the linked tables and nowhere else. /gustav