Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Visual Basic
Expertise: Intermediate
Apr 6, 2000



Application Security Testing: An Integral Part of DevOps

Reattach and Refresh SQL Links

You often need to reattach or refresh links in Microsoft Access. This code refreshes all currently linked tables to sync the attached tables with the server, then remove "dbo_" from all attached SQL Server tables. The two table Def loops allow you to re-sync tables after "dbo_" is removed:
Dim tbDef As TableDef
Dim db As Database
Dim strDBLocation As String
On Error Resume Next
strDBLocation = CommonDialog1.FileName
If strDBLocation = "" Then
End If
Set db = OpenDatabase(strDBLocation)
For Each tbDef In db.TableDefs
	' Refresh table links
Next tbDef
For Each tbDef In db.TableDefs
' Remove all dbo_'s from tables
If Left(tbDef.Name, 4) = "dbo_" Then
	tbDef.Name = Mid(tbDef.Name, 5, Len(tbDef.Name) - 4)
End If
Next tbDef
Michael Finley
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date