Runtime error 3001: Invalid argument when using tabledef.refreshlink

I have some code to update my linked tables if the database they are contained in has a new location. When I run it I get an invalid argument error on the .refreshlink method.
Private Sub UpdateLinkedTables()
Dim itblFCRateApplicationPathRS As Recordset
Dim db As Database
Dim tblFCRate As TableDef
Dim itblFCRateInformation As TableDef
Dim itblFCRateOutputDirectories As TableDef
 
    Set itblFCRateApplicationPathRS = CurrentDb.OpenRecordset("itblFCRateApplicationPath", dbOpenDynaset)
    itblFCRateApplicationPathRS.MoveFirst
    
    If strInitialApplicationPath <> itblFCRateApplicationPathRS!Path Then
        Set db = CurrentDb
        
        Set tblFCRate = db.TableDefs("tblFCRate")
        Set itblFCRateInformation = db.TableDefs("itblFCRateInformation")
        Set itblFCRateOutputDirectories = db.TableDefs("itblFCRateOutputDirectories")
        
        tblFCRate.Connect = ";DATABASE = " & itblFCRateApplicationPathRS!Path
        tblFCRate.RefreshLink
        
        itblFCRateInformation.Connect = ";DATABASE = " & itblFCRateApplicationPathRS!Path
        itblFCRateInformation.RefreshLink
        
        itblFCRateOutputDirectories.Connect = ";DATABASE = " & itblFCRateApplicationPathRS!Path
        itblFCRateOutputDirectories.RefreshLink
        
        Set tblFCRate = Nothing
        Set itblFCRateInformation = Nothing
        Set itblFCRateOutputDirectories = Nothing
        
        db.Close
        Set db = Nothing
    End If
    
    itblFCRateApplicationPathRS.Close
    Set itblFCRateApplicationPathRS = Nothing
End Sub

Open in new window

LVL 1
bejhanAsked:
Who is Participating?
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Connect With a Mentor Commented:
Well, this is how my connection strings look - when you look at a linked table property sheet:


DATABASE=C:\aaaaSCE\Databases\QA\P3DevMaster\BackEnd\QADataP3.mdb;TABLE=tblAudit

So, where is the table name ?

0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Put a break point on this line of code:

        itblFCRateOutputDirectories.Connect = ";DATABASE = " & itblFCRateApplicationPathRS!Path


then see what the actually Connect string is.

mx
0
 
bejhanAuthor Commented:
;DATABASE = M:\Bus_Activity\Finance_Collections\HAULTAIN\cdc\Bejhan\Applications\FC Rate\fcrate.mdb
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
bejhanAuthor Commented:
Okay tried again with:

;DATABASE = M:\Bus_Activity\Finance_Collections\HAULTAIN\cdc\Bejhan\Applications\FC Rate\fcrate.mdb;TABLE=tblFCRate

Same problem. I also tried without the semicolon before "DATABASE" and then I got a different error:

Runtime error 3170: 'Could not find installable ISAM'
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
I think that is an installation problem ...

Try Help>>Detect and Repair from the menu inside Access.

mx
0
 
bejhanAuthor Commented:
Tried that still get the ISAM error. What else can I do? The syntax without the colon in front of the "DATABASE" is correct then?
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
I'm pretty sure you need the Semi Colon.  But, this error is something else I'm pretty sure.

Try googling this ... or search EE (Advanced Search) for Could not find installable ISAM'

I have seen this for quite some time ...

mx
0
 
bejhanAuthor Commented:
You don't think this error could just be occuring due to wrong syntax then?
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Well, the example I posted works for me and has been for a long time.

Does this occur on all 3 RefreshLink statements ?

mx
0
 
bejhanAuthor Commented:
How stupid, it's because I had spaces between the database, equal sign, and path... Thanks for your help.
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
oops:
good catch.  sorry I missed that.  The error message was BOGUS ... misleading ...

mx
0
 
bejhanAuthor Commented:
I figured it would be such. I just remember when I first learned C++ and the compiler would go nuts if there was an extra semi-colon. Saying there was missing libraries and stuff so I figured it must be syntax.
0
All Courses

From novice to tech pro — start learning today.