Adding new links to a front end from a password protected database

  • Thread starter robert demo via AccessMonster.com
  • Start date
R

robert demo via AccessMonster.com

I have an application with my own custom table link manager, since I have a
number of backend files that are linked to the front end. Occassionally,
the links to the backend can get screwed up so I allow administrators to
delete all existing table links. Then I have an Add Links button that
relinks all of the tables uses the following:

RunCommand acCmdLinkTables


However, I have now decided to password protect (database password) my
backends. When I use RunCommand now, I'm asked to provide the database
password.

Does anyone know how to pass the password in code so that the user is not
asked for it? I do not plan to provide the passwords to the administrators
of my application.

Thanks.
 
R

robert demo via AccessMonster.com

I worked out the solution myself using TransferDatabase. However, I have
two questions based on the code below (I successfully used OpenDatabase to
open the password protected backends):

For k = dbOPEN.TableDefs.Count - 1 To 0 Step -1
TableToLink = dbOPEN.TableDefs(k).Name
If dbOPEN.TableDefs(k).Attributes <> -2147483648# And
dbOPEN.TableDefs(k).Attributes <> 2# Then
DoCmd.TransferDatabase acLink, "Microsoft Access", strX,
acTable, TableToLink, TableToLink
End If
Next k


strX is the file name determined from a previous part of the code.

1) It looks like you have to link one table at a time.
2) If I didn't include the Attributes check, the mSys tables were linked
which I didn't want to occur. I determined that they had the numbers
shown, but I'm wondering if I should include others numbers??

Sorry about the messy look of the code.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top