Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

connecting from and back end easy

Status
Not open for further replies.

dixxy12

Technical User
Jun 18, 2007
45
CA
Hi everyone,

I would like to know if there is a way, or if something has already been done to help link the front end database(application) to the back end database(data)?

I work on my project on my laptop. I take a copy of the 'data' databse from the server and bring it with me, then when i get back in the office i connect back to the 'live' data to work. To do this i use the built in 'link table manager' from Access, but it'a always a pain to look for and get the proper path to which data i want to connect to.

i would like to enter a path in a text box store that, and then just click a button to say link data....something along those lines.....

I'm sure someone has done this before...

Thanks for the help,

Sylvain
 
Thanks for the response...

read throught the comments, looks really close to what i would like..the only thing is that i don't keep front and back end into same directory.....not being an expert at code, can i have the 2 files in different folders and somehow modify this code to work that way?

Thanks,

Sylvain
 
Yep, just find the line that says they're in the same path an insert a line to set that to the value you want before moving on. Gotta go out now but if you look it shouldn't be too hard. Will look when i get back if you've not cracked it. Let me know...

JB
 
if this is for your use only and you dont need anything funcky, look at the lines that do the actual work. Below is a composite of all you should need

Code:
    dim db as database
    Dim tdf As TableDef
    Dim i As Integer
    Dim strConnect As String

    set db=currentdb
    
    DoCmd.Hourglass True
    strConnect = ";Database=[red]u:\projects\MyDB.mdb[/red]" 
    For Each tdf In db.TableDefs
       If strConnect <> tdf.Connect Then
             ' refresh link
             tdf.Connect = strConnect
             tdf.RefreshLink
       Endif
   next 
   docmd.hourglass false
   msgbox("Tables relinked")

JB
 
Thanks JB,

Will work on this..may take a bit of time, but will try to report back with results..

Thanks again,

Sylvain
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top