Subject |
Re: Error Code 239 IDAPI error |
From |
Edward Racht <eracht@yahoo.com> |
Date |
Sat, 21 Oct 2023 14:09:48 -0400 |
Newsgroups |
dbase.getting-started |
FYI
Here is a thread about the timer in the getting-started newsgroup.
Appears to involve your issue.
ed
-------------------------
Object Re: timer class
From Mervyn Bick <invalid@invalid.invalid>
Date Sun, 24 Jul 2022 13:32:47 +0200
Newsgroups dbase.getting-started
On 2022/07/24 12:43, Mustansir Ghor wrote:
> Dear All
>
> One more issue has come up with me.
>
> After using a timer class in the form ,a statement
form.databasename.emptytable(" xyz") says file is in use by another on a
second attemp on form run. After 1st run when I click form design button
I think due to timer, the database must not have closed.
>
> Can anybody suggest if we rectify this problem.
It is extremely important to manually deactivate any timer object on a
form in the form's canClose or onClose event handler. If you don't
deactivate it it keeps on ticking away in memory until you actually
close dBASE. Type help timer class in the Command Panel and then
click on the link to the example at the top of the page.
Most objects on a form are closed and released automatically when a form
is closed. As an aside, it is good programming (although too many
programmers seem to not do this) to deactivate all objects manually
before closing a form.
If all objects on the form are inactive when the form is closed Windows
will release the form and clear it from memory. If anything in the form
accesses an active object in memory then Windows keeps the form in
memory. If you open the form a second time Windows doesn't load and run
the code again it simply uses the code already in memory.
The emptyTable() method of a database object requires exclusive use of
the table. This means that in your form the method has to be executed
before the query that accesses the table is made active. When Windows
executes the copy kept in memory the second time round the query is
active because it was active when the form was closed. The table is,
therefore, in use and the emptyTable() method can't be executed.
Mervyn.
|
|