Form unloading when closing connection

brian12

New member
Local time
Today, 09:09
Joined
Aug 6, 2012
Messages
2
I have a form with multiple subforms. The ADO connection is opened to populate the fields in the form and subforms and closed afterwards so it does not slow down the servers. In Access 2003, it works fine, but 2007 causes all the subforms to unload when the connection tries to close.

To close the connection, I use this code
connection.Close
Set connection = Nothing

When it runs connection.close it goes straight to form unload for the subforms. Then it tries to load the subforms after it unloads them. Then I get an error saying
Run-time error'-2147417848 (80010108)':
Method populatedata of object form_transactions failed.

If anyone has any idea, please let me know.
 
I don't understand your use of load and unload in this context. Could you please explain the steps you took and the outcome.
 
if you close the connection, what are you expecting to see in the subforms?

if the subforms are populated from the ADO connection it would make sense once you terminate that connection then the data would no longer be available for display in your subform
 
In Access 2003, The fields are still populated after closing the connection. If I do leave the connection open, the forms do not unload and open fine because connection.close is never called. The problem with leaving the connection open is that it will stress the server, since many people will be using this. Also, The form should still open with blank fields even if the connection gets closed. It shouldn't be trying to unload the subforms when closing the connection right?

When I say unload, I am talking about the event form unload.
When I open up the form, it goes to the event form_load. It opens an ADO connection and creates a recordset, then populates the fields in the form and subform. After the fields are populated, the recordset and the connection get closed. This works in 2003, but in 2007 when it tries to close the connection, it goes to form unload some reason.
 

Users who are viewing this thread

Back
Top Bottom