Max Wanadoo
max.wanadoo at gmail.com
Thu Jul 9 03:49:18 CDT 2009
yes, thanks Gustav/Andy. I will try that later and let you know how I get on. Max On Thu, Jul 9, 2009 at 9:38 AM, Andy Lacey <andy at minstersystems.co.uk>wrote: > Hi Max > > I use code to look at the connect string of the first linked table. There's > a "pwd=" bit followed by the password. You can store that. I don't use > TransferDatabase to relink so I wouldn't know how to place the pw in that. > I > do what Gustav has here, whuich is to rewrite the connect string and > RefreshLink for each tabledef. So you loop through the tables and for each > one you get the connect string, replace the bit that follows DATABASE= (ie > the path and db name) with the new path and db name and rewrite it back to > the connect. > > Andy > > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock > Sent: 09 July 2009 09:24 > To: accessd at databaseadvisors.com > Subject: Re: [AccessD] Linking Databases > > > 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 > > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com >