[AccessD] Linking Databases

Gustav Brock Gustav at cactus.dk
Thu Jul 9 03:23:56 CDT 2009


Hi Max

You should be able to operate on each TableDef:

   dbs.TableDefs(TableName).Connect = ";DATABASE=" & strConnect
   dbs.TableDefs(TableName).RefreshLink

Build your connect string to include the password. You can look the string up by looking at a successfully connected tabledef.

/gustav


>>> max.wanadoo at gmail.com 09-07-2009 09:55 >>>
Hi List,
I have a BE which has an mdb password on it. It prompts for this when you
open it directly.

On the FE, I have code which re-links the BE on demand using this
structure:-

        DoCmd.TransferDatabase acLink, "Microsoft Access", strPathMain,
acTable, strLinkThisTable, strLinkThisTable, False, False

During the transfer it will prompt for the user password.

1st Q.  I would like this to be passed in code so that the user does not
need to enter it.  Is this possible?

2nd Q. When I copy the BE from the Server to my PC and then run the same
relinking code, it does NOT prompt for the BE password.  Why not?  (it does
if it is opened directly, but not from within my code).

The code to determine which is:-

  If bUserWantsNetwork Then
    DoCmd.TransferDatabase acLink, "Microsoft Access", conDataPathNetwork &
conDatabaseMain, acTable, "mcmSystemInfo", "mcmSystemInfo", False, False
  Else
    DoCmd.TransferDatabase acLink, "Microsoft Access", conDataPathLocal &
conDatabaseMain, acTable, "mcmSystemInfo", "mcmSystemInfo", False, False
  End If

NB. the table mcmSystemIno and another file holds details of which tables
are to be linked and it loops through them linking accordingly.

Max






More information about the AccessD mailing list