I am creating a runtime package which contains classes that my main application can use, but I'm having problems with the data access. My main app contains a TDatabase which points to a BDE alias. At runtime my package is dynamically loaded, and a method invoked in the package which creates a TQuery and opens it, populates an object with the returned data and then returns the object to the main app. The TQuery uses the TDatabase in the main app to connect to the database. All this works fine, but when I close the app I get an access violation: "Project C:...GUI.exe faulted with message 'access violation at 0x7c9102db: write of address 0x00040ffc'. Process Stopped. Use Step or Run to continue". If my method creates the TQuery but doesn't open it then this error does not occur. I have no idea why this happens! When I close th app my TQuery is closed and freed ok, my package is unloaded ok, but after the form is destroyed the error occurs. I'm using Delphi 5 BTW, I've tried to be brief so if I have missed out any helpful info let me know, any help gratefully received.
Thanks
p.s. I know that using Delphi 5 and BDE is archaic but I'm stuck with it for now!