Darren D
darren at activebilling.com.au
Tue Dec 18 18:20:04 CST 2007
Hi Borge
I have a Macro Named AUtoExec - In it I have "RunCode" as the action
And have " f_TableLinksRefresh("MyData\MyBE.mdb") a the details in the function
name
Where the cool code that Joe Supplied (TableLinksRefresh) sits in a module in
the FE
Hope this is useful
DD
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'-----------------------------------------------------------------
' Sub f_TableLinksRefresh()
' Refresh all links to use Access BE database
' in the same directory as the calling program
' strFile = name of backend mdb (no path)
'-----------------------------------------------------------------
Public Function f_TableLinksRefresh(ByVal strBEFilePath As String) As Boolean
'RefreshLinks Orig Name from Joe
On Error GoTo f_TableLinksRefresh_Err
Const strAccessPrefix = ";DATABASE="
Dim strLinkName As String
Dim tdf As TableDef
strLinkName = Left$(CurrentDb.Name, InStrRev(CurrentDb.Name, "\")) &
strBEFilePath ' 'The line above gets the current drive letter and wraps it with
the "KNOWN" db name and 'folder
For Each tdf In CurrentDb.TableDefs
If Len(tdf.Connect) > 0 Then
If Left$(tdf.Connect, Len(strAccessPrefix)) = strAccessPrefix Then
If InStrRev(tdf.Connect, strBEFilePath) > 0 Then
tdf.Connect = strAccessPrefix & strLinkName
tdf.RefreshLink
End If
End If
End If
Next tdf
f_TableLinksRefresh = True
g_BackEndPath = strLinkName
f_TableLinksRefresh_Exit:
Exit Function
f_TableLinksRefresh_Err:
MsgBox "Unexpected error while refreshing links to data path" & vbCrLf &
Err.Description, vbInformation + vbOKOnly, "Relink error"
f_TableLinksRefresh = False
Resume f_TableLinksRefresh_Exit
End Function
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DD
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of pcs at azizaz.com
Sent: Wednesday, 19 December 2007 11:10 AM
To: Access Developers discussion and problemsolving
Subject: Re: [AccessD] A2003: Putting both Front and Back ends on a removable
drive
Hi Darren,
Yeah, all makes sense...
But, what's the "the
cool code that determines the current drive letter" ?
Maybe I didn't follow the whole thread, just let me know if
it was supplied as well on the list....
Thanks!!
Borge
---- Original message ----
>Date: Wed, 19 Dec 2007 10:59:40 +1100
>From: "Darren D" <darren at activebilling.com.au>
>Subject: Re: [AccessD] A2003: Putting both Front and Back
ends on a removable drive
>To: "'Access Developers discussion and problem solving'"
<accessd at databaseadvisors.com>
>
>Hi Borge
>
>This didn't work for me either - I got the same error you
describe
>What did work was...
>
>The very very first time I attached the tables I had to use
>say...E:\Mydata\MyBE.mdb
>And did it the manual way from the drop down menus - Get
External data - Link
>Tables etc
>
>Simple so whilstever the device is plugged in and is told
to be E:\ - No prob
>
>When the drive is removed and plugged in again - especially
if it is plugged to
>another machine the drive letter will/may change- then we
get issues
>
>So...You run some cool code on the FE as soon as it is
started to determine the
>new drive letter of your device - then you simply wrap that
new drive letter
>into a string with your "KNOWN" data folder and "KNOWN"
backend database name
>
>So the KNOWN data folder is in a string "MyData\" and the
BE dB name is also in
>that string as "MyBE.mdb" - so the 2 together
= "MyData\MyBE.mdb" then with the
>cool code that determines the current drive letter (Let's
say it is W:\ this
>time) we wrap it all together into a long
string "W:\Mydata\MyBE.mdb" and pass
>it to the refresh links routine
>
>Sounds tricky - Isn't once you realise you can't virtualise
this - must
>determine current drive letter then pass that newly
discovered drive letter with
>some known text in a string to a refresh routine
>
>Make sense?
>
>Darren
>-----------------
>T: 1300 301 731
>-----Original Message-----
>From: accessd-bounces at databaseadvisors.com
>[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
pcs at azizaz.com
>Sent: Wednesday, 19 December 2007 1:15 AM
>To: Access Developers discussion and problemsolving
>Cc: pcs at azizaz.com
>Subject: Re: [AccessD] A2003: Putting both Front and Back
ends on aremovable
>drive
>
>Darren and Team,
>ok... I give in ...
>I put a USB stick in my laptop ... is recognized as E:
>I name the USB stick to JET_USB ...
>now displays as JET_USB (E:) in Windows Explorer...
>I open a cmd dos window and try
>dir \\JET_USB\*.*
>and get returned:
>Network Drive was not found...
>
>So what am I not doing right?
>
>Regards
>Borge
>
>
>---- Original message ----
>>Date: Tue, 18 Dec 2007 09:00:40 +1100
>>From: "Darren D" <darren at activebilling.com.au>
>>Subject: Re: [AccessD] A2003: Putting both Front and Back
>ends on aremovable drive
>>To: "'Access Developers discussion and problem solving'"
><accessd at databaseadvisors.com>
>>
>>Hi team
>>Thanks to those who responded
>>Brilliant
>>I get the logic and am using Joe's clever code
>>
>>Many thanks
>>DD
>>
>>-----Original Message-----
>>From: accessd-bounces at databaseadvisors.com
>>[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
>Jim Lawrence
>>Sent: Monday, 17 December 2007 12:45 PM
>>To: 'Access Developers discussion and problem solving'
>>Subject: Re: [AccessD] A2003: Putting both Front and Back
>ends on aremovable
>>drive
>>
>>Hi Darren:
>>
>>If each drive is named then those names should be able to
>be used. If one
>>drive was named BE and the other was named FE then I
>believe the following
>>would work when referring to one or the other:
>>
>>\\FE\MyFE_Direcory and \\BE\MyBE_Directory
>>
>>Jim
>>
>>-----Original Message-----
>>From: accessd-bounces at databaseadvisors.com
>>[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
>Darren D
>>Sent: Sunday, December 16, 2007 4:32 PM
>>To: 'Access Developers discussion and problem solving'
>>Subject: [AccessD] A2003: Putting both Front and Back ends
>on a removable
>>drive
>>
>>Hi Team
>>
>>
>>
>>I have a client who has one of those portable laptop
drives
>in a USB case -
>>Cool
>>
>>
>>
>>He wants both the front and back ends of his APP to reside
>on this drive but
>>wants the Front
>>
>>end and Back end to still remain separate - for ease of
use
>of data backup -
>>Cool also
>>
>>
>>
>>This means getting the front end to 'talk' to the back end
>without using
>>drive
>>letters etc
>>
>>
>>
>>In the old DOS days you could use a syntax (I have
>forgotten it) to simply
>>refer
>>to 'things'
>>
>>on the current drive and even current folder
>>
>>
>>
>>Does anyone know how I would go about linking the FE and
BE
>on the same
>>drives
>>
>>(In this case a removable one) thus without using drive
>letters etc?
>>
>>
>>
>>Many thanks in advance
>>
>>
>>
>>DD
>>
>>--
>>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
>>
>>--
>>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
>
>No virus found in this incoming message.
>Checked by AVG Free Edition.
>Version: 7.5.503 / Virus Database: 269.17.4/1188 - Release
Date: 17/12/2007 2:13
>PM
>
>
>No virus found in this outgoing message.
>Checked by AVG Free Edition.
>Version: 7.5.503 / Virus Database: 269.17.4/1188 - Release
Date: 17/12/2007 2:13
>PM
>
>
>--
>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
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.17.4/1188 - Release Date: 17/12/2007 2:13
PM
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.17.4/1188 - Release Date: 17/12/2007 2:13
PM