references.remove not removing reference

DataMiner

Registered User.
Local time
Today, 10:27
Joined
Jul 26, 2001
Messages
336
The following piece of code runs on an on_close event of a form in my db, when the db itself closes.

Function 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 "removing reference to " and the path to excel
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?
 

Users who are viewing this thread

Back
Top Bottom