
Please help: run-time error 3014-can't open any more tables
Quote:
> I have a table with 17 Data Controls, all of them with the RecordsetType
> "Dynaset". After loading and unloading the forms a few times, I get the
> run-time error 3014, telling me that I can't open any more tables.
> Those recordsets shouldn't be closed automaticly, when the form unloads?
If you dim up a recordset object in a local procedure (i.e. sub or
function or property) as a variable, then all references to it will
be destroyed as soon as you leave the procedure. As a result, the
garbage collection mechanism kicks in and removes it for you. This
is pretty much guaranteed.
In contrast, recordset objects with global scope, which is effectively
what those associated with 'global' form controls are, aren't known for
their 'garbage-safe' integrity. You have to ensure that all references
to such objects are torn down yourself. Setting the variable (the
object reference) to Nothing does this. Naturally, you should .Close
the recordset first (courtesy), but the setting to Nothing should do
this - as the object 'dies', it should .Close whatever it's got.
In *principle*, when a form is unloaded, all of these controls,
specifically the data controls, should get dereferenced and die
gracefully. However, there seems to be some evidence that this
does not always happen. I tend to avoid data controls for this
reason. My avoidance of such may be more to do with myth and
legend than actuality, but I find that direct DAO programming
allows me to take care of my own quality control in this regard.
Quote:
> Thank you in advance.
> Pedro Vieira
--
Paul Sampson____Principal Consultant Onyx Systems______Onyx Internet
Zetland Buildings__Exchange Square__Middlesbrough__TS1 1DE__UK 33711 \\/+
BB 74 A4 EF 03 F8 44 C1 F3 75 FE C6 7E F9 6E 43 http://www.onyx.net >--<