views:

51

answers:

2

In Access, always supposed that in Forms modules, as in other (class or regular) modules, objects and normal variables cease to exist when the code is exited, or in the case of Forms, when the form is closed. Is that correct ?

I am wondering because I built a form used to scan barcodes on orders, and it gets slower and slower during the day, until the user closes and reopens the DB, then everything is back to normal. Closing the form does not seem to be enough. I analysed my code, and I can't find much, so serching for the culprit...

+2  A: 

I think ideally when objects go out of scope they will be destroyed and the memory they used will be released. However, since sometimes things don't go according to plan, I thought we're supposed to explicitly close and release any recordset objects we create in our code ... just to be safe.

HansUp
A: 

Is this form being opened and closed many times during the session? I had a problem in Access 97 where a similar problem would occur. Hideing the form instead of closing it and then making it visible again solved the problem. However any form level variables had to be explicitly set to zero or zero length strings.

Tony Toews
It is opened and closed many times. In my case I suspect it has somthing to do with frmMenu opening frmInvoices and then invoking frmInvoices.cmdScan method which opens the frmScan in dialog mode (it's a shortcut to avoid a few clicks to the user, by request). The dialog mode here probably prevents some things to be properly closed.
iDevlop