Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / September 2005

Tip: Looking for answers? Try searching our database.

use code to link to external database

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
nafr - 16 Sep 2005 16:03 GMT
I have a MDB front end which contain sall the forms/queries/macros and which
links to another MDB which contains all the tables. Nothing very clever.

I update the front end on my laptop quite frequently and need to then copy
it to the server. I have a backend on my laptop as well to allow me to test
the frontend and because I also link the front end ot some tables on my PC.

Because I need to be able to link to 2 or 3 differnet backend DBs, it is a
real pain having to use the linked table manager to recreate the links to all
the tables. I used to be able to do this in code in Access97 but the code no
longer worked when I upgraded to Access 2003.

Anybody got any clues?
Alex Dybenko - 16 Sep 2005 16:41 GMT
Hi,
i dont have a sample of such proc around, by idea is simple - you make a
local table, where you list all tables to relink and in other field some
kind of code, showing to which db it should be attached.
then you take a proc to relink tables from www.mvps.org/access and modify it
so it read table list from tis table, and ask new path each time new code
comes with next table.
HTH
Signature

Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com

>I have a MDB front end which contain sall the forms/queries/macros and
>which
[quoted text clipped - 14 lines]
>
> Anybody got any clues?
Allen Browne - 16 Sep 2005 16:51 GMT
There is a module in solutions.mdb (sample database) that checks if the data
is available on startup. If not, it pops up the File Open dialog to let you
locate the data.

Download from:
   http://msdn.microsoft.com/library/officedev/bapp2000/mdbdownload.htm

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

>I have a MDB front end which contain sall the forms/queries/macros and
>which
[quoted text clipped - 14 lines]
>
> Anybody got any clues?
Carol Grismore - 16 Sep 2005 17:36 GMT
Sub AutoReconnect()

   Dim db As Database
   Dim tdf As TableDef
   Dim cnt As String
   Dim X As Integer
   Dim rtn As Integer
   
   rtn = SysCmd(acSysCmdSetStatus, "Reconnecting database objects...")
   
   Set db = CurrentDb
   
   For X = 0 To db.TableDefs.Count - 1
   
       Set tdf = db.TableDefs(X)
       cnt = tdf.Connect
       
       ' Already connected to the requested database.
       strCurrent = Mid(cnt, 10, 6)
       If strCurrent = strDSN Or strCurrent = (strDSN & ";") Then GoTo NextX
       
       ' Refresh all connections.
       If tdf.NAME Like "dbo_*" Then
           cnt = "ODBC;DSN=" & UCase(strDSN) & ";SRVR=FRED;DB=" &
LCase(strDSN) & ";"
           tdf.Connect = cnt
           tdf.RefreshLink
       End If
       
       Set tdf = Nothing
NextX:
       
   Next X

   Set db = Nothing

End Sub

Signature

Carol

> There is a module in solutions.mdb (sample database) that checks if the data
> is available on startup. If not, it pops up the File Open dialog to let you
[quoted text clipped - 21 lines]
> >
> > Anybody got any clues?
nafr - 17 Sep 2005 17:51 GMT
Carol

Thanks for the code. Not sure how it works but will investigate further. I
dont know if the following will clarify things further or not.

I am hoping to be able to link a numbe rof taboles to differnet backend
MDBs. The location of the seperate MDBs will also change depending on whether
I am on the network at work, a satelite office with its own server or at home
on the laptop.

The front end is the same mdb in all three situations.

I had hoped to be able to offer the user (myself anfd others) the option at
start up to indicate their current location and then use code to refresh the
links as appropriate.

If your code is the right answer then thanks, but if not any other clues?

Thanks

Nick

> Sub AutoReconnect()
>
[quoted text clipped - 59 lines]
> > >
> > > Anybody got any clues?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.