G
Guest
Hi,
I have two frontend databases - db1 and db2 - which link to two separate backend databases. When either db1 or db2 is opened, code is run to refresh the links to the appropriate backend database. The code used to perform the refresh is Dev Ashish's code located at http://www.mvps.org/access/tables/tbl0009.htm, which resides in a module within each of the frontends.
Additionally, db1 has a reference to db2, to allow users of db1 to pull up reports from db2 without having to actually open db2. The problem is that without actually opening db2, the table links in db2 are not refreshed before reports are run. I've tried to resolve this, in db1, by calling db2.fRefreshLinks() prior to opening the report. For some reason, the code completes without error, but when I subsequently open db2 to verify that the links have in fact been refreshed, I find that they haven't.
My code is below; I would greatly appreciate any suggestions as to where I am going wrong.
Thanks in advance for any input,
Matt
Private Sub cmdRefreshdb2_Click()
Dim ref As Reference
On Error GoTo 0
Set ref = References.AddFromFile("c:\database\db2.mdb")
Application.Run "db2.fRefreshLinks"
'fRefreshLinks is a public function located in a module within db2
References.Remove ref
Set ref = Nothing
End Sub
I have two frontend databases - db1 and db2 - which link to two separate backend databases. When either db1 or db2 is opened, code is run to refresh the links to the appropriate backend database. The code used to perform the refresh is Dev Ashish's code located at http://www.mvps.org/access/tables/tbl0009.htm, which resides in a module within each of the frontends.
Additionally, db1 has a reference to db2, to allow users of db1 to pull up reports from db2 without having to actually open db2. The problem is that without actually opening db2, the table links in db2 are not refreshed before reports are run. I've tried to resolve this, in db1, by calling db2.fRefreshLinks() prior to opening the report. For some reason, the code completes without error, but when I subsequently open db2 to verify that the links have in fact been refreshed, I find that they haven't.
My code is below; I would greatly appreciate any suggestions as to where I am going wrong.
Thanks in advance for any input,
Matt
Private Sub cmdRefreshdb2_Click()
Dim ref As Reference
On Error GoTo 0
Set ref = References.AddFromFile("c:\database\db2.mdb")
Application.Run "db2.fRefreshLinks"
'fRefreshLinks is a public function located in a module within db2
References.Remove ref
Set ref = Nothing
End Sub