Old code, new problem?
The following code worked just fine - built using Access 2002 under XP. Now with Vista (I don't know if this might be the problem) and newer Windows OSs, the code fails at the db.Relations.Delete db.Relations(iRel).Name line with a Runtime 3033 error that says I don't have permission to use the MSysNavPaneGroupToObjects object. Can anyone point me in the right direction to correct this? We're now running the app under 2010 and sometimes 2007. Thanks in advance!!!
The following code worked just fine - built using Access 2002 under XP. Now with Vista (I don't know if this might be the problem) and newer Windows OSs, the code fails at the db.Relations.Delete db.Relations(iRel).Name line with a Runtime 3033 error that says I don't have permission to use the MSysNavPaneGroupToObjects object. Can anyone point me in the right direction to correct this? We're now running the app under 2010 and sometimes 2007. Thanks in advance!!!
Code:
Dim db As Database
Dim iRel As Integer
Dim tbl As TableDef
Dim Response As Variant
Set db = CurrentDb()
DoCmd.SetWarnings False
' For iRel = db.Relations.Count - 1 To 0 Step -1
' db.Relations.Delete db.Relations(iRel).Name
' Next iRel
For iRel = db.Relations.Count - 1 To 0 Step -1
If Not db.Relations(iRel).Name = "MSysAccessStorageSTGREL" Then
db.Relations.Delete db.Relations(iRel).Name
End If
Next iRel