Solved

Runtime error 3001: Invalid argument when using tabledef.refreshlink

Posted on 2008-06-20
12
1,709 Views
Last Modified: 2008-06-20
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

0
Comment
Question by:bejhan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
12 Comments
 
LVL 75
ID: 21833099
Put a break point on this line of code:

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


then see what the actually Connect string is.

mx
0
 
LVL 1

Author Comment

by:bejhan
ID: 21833155
;DATABASE = M:\Bus_Activity\Finance_Collections\HAULTAIN\cdc\Bejhan\Applications\FC Rate\fcrate.mdb
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 125 total points
ID: 21833208
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:bejhan
ID: 21833276
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
 
LVL 75
ID: 21833291
I think that is an installation problem ...

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

mx
0
 
LVL 1

Author Comment

by:bejhan
ID: 21833359
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
 
LVL 75
ID: 21833422
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
 
LVL 1

Author Comment

by:bejhan
ID: 21833440
You don't think this error could just be occuring due to wrong syntax then?
0
 
LVL 75
ID: 21833546
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
 
LVL 1

Author Comment

by:bejhan
ID: 21833752
How stupid, it's because I had spaces between the database, equal sign, and path... Thanks for your help.
0
 
LVL 75
ID: 21833776
oops:
good catch.  sorry I missed that.  The error message was BOGUS ... misleading ...

mx
0
 
LVL 1

Author Comment

by:bejhan
ID: 21833932
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

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Compress Newid value ms sql Mssql 4 48
Combo box question 6 55
ACCESS / VBA - Count of Rows in Table 4 47
Outlook mail to Access 8 28
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question