Object Invalid or no longer set (1 Viewer)

Gavx

Registered User.
Local time
Today, 15:16
Joined
Mar 8, 2014
Messages
151
I am running this code but am receiving the error in the subject;
Code:
Private Sub cmdUpdate_Click()

Dim dbsCur As Database

Set dbsCur = OpenDatabase("C:\Users\Gavin\Front End\MyFile.accdb")

Dim tdf As TableDef
    Set tdf = CurrentDb.TableDefs("tblCSVData")
    If Len(tdf.Connect) > 0 Then
        tdf.RefreshLink
    End If
Set dbsCur = Nothing

End Sub
The error appears on the line If Len(tdf.Connect) > 0 Then

Anyone can help please,

thanks
 

Minty

AWF VIP
Local time
Today, 06:16
Joined
Jul 26, 2013
Messages
10,371
Shouldn't this
Code:
  Set tdf = CurrentDb.TableDefs("tblCSVData")
actually be this ?
Code:
   Set tdf = [COLOR="Red"]dbsCur[/COLOR].TableDefs("tblCSVData")
 

Users who are viewing this thread

Top Bottom