Object Invalid or no longer set

Gavx

Registered User.
Local time
Today, 19:41
Joined
Mar 8, 2014
Messages
155
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
 
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

Back
Top Bottom