473,507 Members | 2,441 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Strange behavior with Dev Ashish's fRefreshLinks function (from Access Web)

Hi all,

(WinXP Pro SP2, Access 2003)

I'm using Dev Ashish's fRefreshLinks function from AccessWeb
(http://www.mvps.org/access/tables/tbl0009.htm) to relink tables in my
front end to one of several back end files.

When I first dropped in the function I was getting an error on one of
my tables saying "Couldn't relink table, table doesn't exist"... or
something similar, for one of my tables. Of course, this wasn't the
case, the table exists, and in fact could be relinked using the Linked
Table Manager in Access. After a few hours of confusion, I deleted the
linked table, reimported it, then reran Dev Ashish's code. This worked,
and the function, continues to work at this time.

My question: any thoughts on why this happened and what can be done to
prevent it in the future.

Within the fRefreshLinks function, this is where the error originates:

If fIsRemoteTable(dbLink, strTbl) Then
'everything's ok, reconnect
Set tdfLocal = dbCurr.TableDefs(strTbl)
With tdfLocal
.Connect = ";Database=" & strDBPath
.RefreshLink
collTbls.Remove (.Name)
End With
Else
Err.Raise cERR_NOREMOTETABLE
End If
End If

fIsRemoteTable(dbLink, strTbl) takes you to the following:

Function fIsRemoteTable(dbRemote As Database, strTbl As String) As
Boolean
Dim tdf As TableDef
On Error Resume Next
Set tdf = dbRemote.TableDefs(strTbl)
fIsRemoteTable = (Err = 0)
Set tdf = Nothing
End Function

Which returns False, thus putting you back into Err.Raise
cERR_NOREMOTETABLE, and thusly the error.

Now to be perfectly clear, I don't completely understand all of the
code in the functions, although I have the Access 2002 Developer's
Handbook and I'm attempting to figure it all out :D.

Anyhow, any thoughts would be greatly appreciated on why this happened
and how to prevent it from happening in the future would be
appreciated.

Best,

Kelii

Jan 26 '07 #1
4 3778
Kelii, is this a secured database (i.e. permissions controlled by an MDW)?
If so, the message may mean that the user did not have permission to set the
properties.

It could also fail if there were a deleted linked table.
You could avoid that with:
With tdfLocal
If Not tdfLocal.Name Like "~*" Then
.Connect = ";Database=" & strDBPath
.RefreshLink
collTbls.Remove (.Name)
End If
End With

Acess 2000 and later cache much more information about the linked tables
than used to be the case when Dev first wrote that. There are cases where
the cached info can cause problems. You could probably avoid those problems
(and the deleted table issue above) by compacing the database, and then
trying to link again.

The cached table info can even cause problems after a successful relink.
Compacting after the relink also can avoid those problems.

--
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.

"Kelii" <ke****@yahoo.comwrote in message
news:11**********************@q2g2000cwa.googlegro ups.com...
Hi all,

(WinXP Pro SP2, Access 2003)

I'm using Dev Ashish's fRefreshLinks function from AccessWeb
(http://www.mvps.org/access/tables/tbl0009.htm) to relink tables in my
front end to one of several back end files.

When I first dropped in the function I was getting an error on one of
my tables saying "Couldn't relink table, table doesn't exist"... or
something similar, for one of my tables. Of course, this wasn't the
case, the table exists, and in fact could be relinked using the Linked
Table Manager in Access. After a few hours of confusion, I deleted the
linked table, reimported it, then reran Dev Ashish's code. This worked,
and the function, continues to work at this time.

My question: any thoughts on why this happened and what can be done to
prevent it in the future.

Within the fRefreshLinks function, this is where the error originates:

If fIsRemoteTable(dbLink, strTbl) Then
'everything's ok, reconnect
Set tdfLocal = dbCurr.TableDefs(strTbl)
With tdfLocal
.Connect = ";Database=" & strDBPath
.RefreshLink
collTbls.Remove (.Name)
End With
Else
Err.Raise cERR_NOREMOTETABLE
End If
End If

fIsRemoteTable(dbLink, strTbl) takes you to the following:

Function fIsRemoteTable(dbRemote As Database, strTbl As String) As
Boolean
Dim tdf As TableDef
On Error Resume Next
Set tdf = dbRemote.TableDefs(strTbl)
fIsRemoteTable = (Err = 0)
Set tdf = Nothing
End Function

Which returns False, thus putting you back into Err.Raise
cERR_NOREMOTETABLE, and thusly the error.

Now to be perfectly clear, I don't completely understand all of the
code in the functions, although I have the Access 2002 Developer's
Handbook and I'm attempting to figure it all out :D.

Anyhow, any thoughts would be greatly appreciated on why this happened
and how to prevent it from happening in the future would be
appreciated.

Best,

Kelii
Jan 27 '07 #2

Allen,

Thanks for the reply.

The database isn't secured at all, so permissions shouldn't be an
issue.

As far as the deleted table is concerned, that's a great add to the
code, I'll definately use it.

So, the problem must be the cached info as you suggest. I did not try
compacting the database back end / front end; in fact I did very little
other than stare at my laptop in bewilderment and randomly flip through
my Access library. Next time, I'll do as you suggest, compact the files
and see if that works.

Again, thanks for the reply; and btw, I use your MVP site frequently,
you've provided a great service to Access novices such as myself.

Kelii

Jan 27 '07 #3
"Allen Browne" <Al*********@SeeSig.Invalidwrote in
news:45***********************@per-qv1-newsreader-01.iinet.net.au:
Acess 2000 and later cache much more information about the linked
tables than used to be the case when Dev first wrote that. There
are cases where the cached info can cause problems. You could
probably avoid those problems (and the deleted table issue above)
by compacing the database, and then trying to link again.

The cached table info can even cause problems after a successful
relink. Compacting after the relink also can avoid those problems.
And sometimes the links have to be completely deleted and recreated
to get rid of certain types of cached data that cause extreme
performance degradation.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Jan 27 '07 #4
"Kelii" <ke****@yahoo.comwrote in
news:11**********************@q2g2000cwa.googlegro ups.com:

[To Allen Browne:]
Again, thanks for the reply; and btw, I use your MVP site
frequently, you've provided a great service to Access novices such
as myself.
Not just to novices, Keri -- I use Allen's site almost daily and I
do this for a living and have been doing so for 10+ years.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Jan 27 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5885
by: Ben | last post by:
I have written a procedure which calls the CORREL function of Excel to run correlation analysis on two arrays, then populate a table with the resulting correlation coefficient. This process loops...
3
3464
by: Dalan | last post by:
At first I was not certain what could cause Access 97 from displaying most jpeg images, but not all. After further testing, it seemed that all original images of less than 275 pixels per inch or...
0
1121
by: Glorie | last post by:
Hi all, I use the function fRefreshLinks fro http://www.mvps.org/access/tables/tbl0009.htm to relink access tables from code. I get this error: Error in refreshing links Table tblTeamMS...
4
1872
by: Lauren Wilson | last post by:
Hi folks, I copied Dev Ashish's code below to a module in Access 2K. No mater what I do, Access will not recognize the function. What have I overlooked? I know I'm going to feel like an...
8
1987
by: David | last post by:
This is something I had never seen before. On an aspx page, upon pressing a link button for which I have an event handler in the code behind, the screen shows nothing but a line that says "true"...
0
1445
by: L Scott | last post by:
Have developed a c# / asp.net web app. Works locally. But over the internet when I access the site, it eventually returns a 'The page cannot be displayed' page. Not always on the same page. Can...
6
1686
by: Gary | last post by:
I have an application that has been working just fine for a couple of years. It queries a SQL database and returns some formatted data back to the client. I have a new client, who has a larger...
7
4602
by: Tim_Mac | last post by:
hi, using .net 2.0, i have a web form with lots of textboxes, drop-down-lists etc. There are lots of required field validators and regular expression validators. When i click the 'save' button,...
160
5736
by: DiAvOl | last post by:
Hello everyone, Please take a look at the following code: #include <stdio.h> typedef struct person { char name; int age; } Person;
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7314
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7030
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1540
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.