Back end - dynamic link for relative path

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
 
S

strive4peace

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
*
 
Top