A
alex
On db Exit
Hello,
I have a form that is opened at startup, hidden, and is supposed to
check for idleness and close the db if the user does not respond (the
idle part is not working right, but that’s another post).
This form also has in its close event a call to a function that
deletes a specific group of tables.
When the user closes the db manually, everything works fine. The
reason, I think, is that all forms are closed before the hidden form
that deletes the tables (which must close last).
The problem is when the hidden form detects that the db has been idle
and tries to shut the db down. What I think is happening is that when
the code (application.quit) executes, it tries to close the hidden
form before the others since its index is probably 0 or 1.
This causes an error because the other forms are connected to the
tables that the hidden form is trying to delete (lock table error
3211).
I’m not sure how I should code my way around this problem…I thought
maybe by placing code before the event that deletes all the tables, I
could write something that sets all record sources to “”. That way
none of the tables will be connected to a form when their deleted.
Or, in the hidden idle form, closing all forms Before the idle form
which should sever all connections to any table. I cannot find any
code that sets all record sources to “” or will loop through a forms
collection deleting all forms except one.
What would be cool, is something that mimics the autoexec macro, but
on exit! Just saying…
Thoughts?
Thanks,
alex
Hello,
I have a form that is opened at startup, hidden, and is supposed to
check for idleness and close the db if the user does not respond (the
idle part is not working right, but that’s another post).
This form also has in its close event a call to a function that
deletes a specific group of tables.
When the user closes the db manually, everything works fine. The
reason, I think, is that all forms are closed before the hidden form
that deletes the tables (which must close last).
The problem is when the hidden form detects that the db has been idle
and tries to shut the db down. What I think is happening is that when
the code (application.quit) executes, it tries to close the hidden
form before the others since its index is probably 0 or 1.
This causes an error because the other forms are connected to the
tables that the hidden form is trying to delete (lock table error
3211).
I’m not sure how I should code my way around this problem…I thought
maybe by placing code before the event that deletes all the tables, I
could write something that sets all record sources to “”. That way
none of the tables will be connected to a form when their deleted.
Or, in the hidden idle form, closing all forms Before the idle form
which should sever all connections to any table. I cannot find any
code that sets all record sources to “” or will loop through a forms
collection deleting all forms except one.
What would be cool, is something that mimics the autoexec macro, but
on exit! Just saying…
Thoughts?
Thanks,
alex