Andy Lacey
andy at minstersystems.co.uk
Thu Jul 3 02:16:35 CDT 2003
Stuart It's when the db is protected. Then the connect string contains the password before the database section. Andy Lacey http://www.minstersystems.co.uk > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of > Stuart McLachlan > Sent: 02 July 2003 23:52 > To: Sad Der; accessd at databaseadvisors.com > Subject: Re: [AccessD] Relink tables? > > > On 2 Jul 2003 at 6:58, Sad Der wrote: > > > Hi Group, > > > > does anybody know how i can automaticle relink tables? > > > > Here's the code that I use. It assumes that the BE and FE are in the > same directory. > > As someone pointed out on the list the > "If Left$(tdfloop.Connect, 10) = ";DATABASE=" " can fail under > certain circumstances (I can't remember the details, but under some > setups, there is another parameter bfore the "DATABASE" - can anyone > refresh my memory?). This has always worked in my apps though. > > > > Option Compare Database > Option Explicit > > Function RelinkTables() As Long > Dim tdfloop As TableDef > With CurrentDb > For Each tdfloop In .TableDefs > If Left$(tdfloop.Connect, 10) = ";DATABASE=" Then _ > tdfloop.Connect = ";DATABASE=" & ApplDir & _ > filename(Mid$(tdfloop.Connect, 11)) > tdfloop.RefreshLink > End If > Next tdfloop > End With > End Function > > Function pathname(fullpath As String) As String > Dim STemp As String > pathname = Left$(fullpath, InStrRev(fullpath, "\")) > End Function > > Function filename(fullpath As String) As String > Dim STemp() As String > STemp() = Split(fullpath, "\") > filename = STemp(UBound(STemp)) > End Function > > Static Function ApplDir() As String > Dim strApplDir As String > Dim strTemp As String > If strApplDir = "" Then > strTemp = DBEngine(0)(0).Name > strApplDir = Left$(strTemp, InStrRev(strTemp, "\")) > End If > ApplDir = strApplDir > End Function > > > -- > Lexacorp Ltd > http://www.lexacorp.com.pg > Information Technology Consultancy, Software Development,System > Support. > > > > _______________________________________________ > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/a> ccessd > Website: > http://www.databaseadvisors.com >