IN THE SPOTLIGHT: MDE to MDB Conversion Service
(also supports: ACCDE to ACCDB, ADE to ADP, etc)
IN THE SPOTLIGHT: vbWatchdog
VBA error handling just got easier...
" vbWatchdog is off the chart. It solves a long standing problem of how to consolidate error handling into one global location and avoid repetitious code within applications. "
- Joe Anderson,
Microsoft Access MVP
Meet Shady, the vbWatchdog mascot watching over your VBA code →
(courtesy of Crystal Long, Microsoft Access MVP)
IN THE SPOTLIGHT: vbMAPI
An Outlook / MAPI code library for VBA, .NET and C# projects
Get emails out to your customers reliably, and without hassle, every single time.
Use vbMAPI alongside Microsoft Outlook to add professional emailing capabilities to your projects.
Provided by Allen Browne, email@example.com
Warning: This code is dangerous! It deletes all relationships in the current database.
In some circumstances, Access 95 would fail to display relations between tables in the Relationships window. Since you could not view the relationships, you could not delete them, so your database was inconsistent. This code is provided as a fix.
Function DeleteAllRelationships() As String ' WARNING: Deletes all relationships in the current database. Dim db As Database ' Current DB Dim rex As Relations ' Relations of currentDB. Dim rel As Relation ' Relationship being deleted. Dim iKt As Integer ' Count of relations deleted. Dim sMsg As String ' MsgBox string. sMsg = "About to delete ALL relationships between tables in the current database." & vbCrLf & "Continue?" If MsgBox(sMsg, vbQuestion + vbYesNo + vbDefaultButton2, "Are you sure?") = vbNo Then DeleteAllRelationships = "Operation cancelled" Exit Function End If Set db = CurrentDb() Set rex = db.Relations iKt = rex.Count Do While rex.Count > 0 Debug.Print rex(0).Name rex.Delete rex(0).Name Loop DeleteAllRelationships = iKt & " relationship(s) deleted" End Function
Copy and paste this function into a module. Press Ctrl+G to open the Immediate Window. Enter:
You will then have to rebuild all your relationships from scratch.
|Home||Index of tips||Top|
This is a cached tutorial, reproduced with permission.
Have your say - comment on this article.
What did you think of 'DeleteAllRelationships()'?
No comments yet.
Why not be the first to comment on this article?!
Have your say...