Back end - dynamic link for relative path

  • Thread starter Thread starter Nikos
  • Start date Start date
N

Nikos

Dear all,


I would like to split my databse into a front and back end. I do not
know where the database will reside and would therefore like to set a
relative pathto the backend. I understand CurrentProject.Path will
give the front-end's curent path, but not sure how to then link the
backend dynamically to this path (ie assuming that it is in the same
directory as the front end).
any help welcome.

thank you

nikos
 
Hi Nikos,

here is some code written by John Viescas to Relink tables

'~~~~~

Dim rst As DAO.Recordset, db As DAO.Database, tdf As DAO.TableDef
Dim intFirst As Integer

For Each tdf In db.TableDefs
If (tdf.Attributes And dbAttachedTable) Then
tdf.Connect = ";DATABASE=" & " <new path here >"
tdf.RefreshLink
If Not intFirst Then Set rst = db.OpenRecordSet(tdf.Name)
intFirst = True
End If
Next tdf
If intFirst then rst.Close
'~~~~~~

John leaves one table open while he refreshes the rest -- speeds things
up ;)


Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top