The following piece of code runs on an on_close event of a form in my db, when the db itself closes.
I get the message box saying "reference removed".
But the reference does not get removed. When I reopen the db, it's still there.
When I run this code while the db is open, it seems to work OK. But running it while it's closing doesn;t.....
Any ideas?
I get the message box saying "removing reference to " and the path to excelFunction RemoveExcelRef()
Dim Ref As Reference
For Each Ref In References
' Check IsBroken property.
If Ref.IsBroken = False Then
Debug.Print Ref.Name
If Ref.Name = "excel" Then
MsgBox "Removing reference to " & Ref.FullPath
References.Remove Ref
MsgBox "Reference removed"
End If
Else
MsgBox "GUID of broken ref: " & Ref.Guid
Debug.Print "GUIDs of broken references:"
Debug.Print Ref.Guid
End If
Next Ref
End Function
I get the message box saying "reference removed".
But the reference does not get removed. When I reopen the db, it's still there.
When I run this code while the db is open, it seems to work OK. But running it while it's closing doesn;t.....
Any ideas?