Refresh existing link problem.


C

CT

I am trying to refresh an existing link to an external
database. However, I have the following error at
the .refreshlink statement: Error 3055 DAO.tabledef Not
a valid file name. Please point out problem. CT.


Dim db As DAO.Database
Dim tdf As DAO.TableDef

Dim i As Integer
Dim strTBLNAME As String
Set db = CurrentDb()
For i = 0 To db.TableDefs.Count - 1
strTBLNAME = db.TableDefs(i).Name
MsgBox strTBLNAME
Next
'One of the strTBLNAME values is "ALLPLT" from
for/next loop above.

'What is missing/incorrect in the following code:
'Set db = CurrentDb()
Set tdf = db.TableDefs("ALLPLT")
'strCURRENTDIRVALUE is path&name for external DB
tdf.Connect = (";DATABASE=" & strCURRENTDIRVALUE)
tdf.RefreshLink 'Error occurs at this statement
Set tdf = Nothing
Set db = Nothing
 
Ad

Advertisements

A

Allen Browne

There are many things that could go wrong with this process, e.g.:

1. The file must be present in the path specified, i.e. you cannot link to a
file that is not there.

2. Did you include the ".mdb" in the file name?

3. Test by opening the Immediate window (ctrl+G) and entering:
? Dir(strCURRENTDIRVALUE)

There are many other issues, e.g. the file must be an Access database, in a
location with permissions in Windows, of a version that you can read,
contain the expected name of the table, and not be secured by an mdw (since
you are not providing a username/password).
 
C

CT

Link currently exists and is working correctly.
Permissions ok.
External db is in same directory as front end db.
StrCURRENTDIRVALUE does bring back correct path
including .mdb
Table/Link name is the same.

But I want to re-establish link (invisible to user)if
table in back-end external db was recreated after a
delete. Or after both db moved together to new
subdirectory.

CT
 
Ad

Advertisements

C

CT

Based on the link you provided - I switched from directly
using the name "ALLPLT" to searching thru the TableDefs
names for "ALLPLT" and using the index number to identify
the link to connect and refresh.

CT
 

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

Top