Refresh links to sql server 7.0 from Access

When i try to use access 97 linked table manager to refresh link with sql server 7.0, I am getting error "Invalid procedure or argument called". Is any one know about why this error comes ? Is this right way to refresh link with sql server?
mathivAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
dtomynConnect With a Mentor Commented:
It is the proper way, however sometimes it hits snags.  One of them is if you have updated your MDAC so that you have a different SQL Server driver than before (or at least this has been my experience).  Try the following instead to see what happens:
Private Sub RelinkAllTables()
On Error GoTo errhandler
    Dim tdfTemp As TableDef

    For Each tdfTemp In CurrentDb.TableDefs
        If Left$(tdfTemp.Connect, 5) = "ODBC;" Then
            tdfTemp.RefreshLink
        End If
    Next tdfTemp
    Exit Sub
errhandler:
    MsgBox "Problems were encountered while relinking the SQL Server tables." & _
        vbCrLf & vbCrLf & _
        "Please contact your system administrator.", vbCritical, _
        "Unable to Relink Tables"
    DoCmd.Quit
End Sub

Or if this does not work add your new connection string after the If statement like so:
tdfTemp.Connect = "ODBC;DSN=SomeDSN;Description=SomeDescription;SERVER=SomeServer;DATABASE=SomeDatabase;Trusted_Connection=Yes"
0
 
mathivAuthor Commented:
Adjusted points to 300
0
 
mathivAuthor Commented:
Hi,
 Code above works fine. Thankyou for your help.
0
All Courses

From novice to tech pro — start learning today.