From Xojo Documentation
Allows you to retain a reference to an object without requiring it to stay alive.
|Value||Object||Returns the target object or Nil if the target no longer exists.|
|WeakRef||obj as Object||The target object that you want to retain a reference to after it has been destroyed.|
WeakRef is useful when you want to find out when an object (such as a database or TCP/IP connection) is still in use somewhere in the application. The reference returned by WeakRef goes to Nil as soon as there are no longer any references to the object. This is the signal that you can do any necessary cleanup work.
When the object is destroyed, the WeakRef's value will change to Nil after all ordinary references have been released and the object has been destroyed. Otherwise, the Value property returns the target object.
Dim DBRef as WeakRef
// Create Database Object
// Set Database File
OrdersDB.databaseFile = GetFolderItem("Orders.rsd")