Run Queries on Close of DB without Form??!!

isetea

Registered User.
Local time
Tomorrow, 04:15
Joined
Oct 19, 2006
Messages
24
Hi,
I want to have some queries run during the database is closed, like the functiona with "Repair on Close". But I don't want to use a form with a VBA code doing it. Is there any other possibility to do it? :confused:
Thanks in advance for answers.:)
 
you have to fire instructions in some way. Use the last from that remains open eg switchboard, your startup up form, or some other hidden form, and have that fire your events on its unload or close event.

Onec the dbs is closed however, you have nothing to run, so you have to use a form somewhere.
 
Mhm. I see the point. I have the event triggered by the close of the form. But if the user exits the database without closing the form first, it's not running. Should I take the unload event instead? Is this running even the user exits the database directly?
Thanks for your advice.
 
I tried the UnloadEvent of a visible form and it did not work. Is it different to a hidden form? If yes, how can I hide a form?
Cheers
 
I have some make-table-queries in database1, which I want to have run after updates in several tables in database1 are made. I thought the best would be to run them very on the end, when the user is going to close database1. Because in database2 other users select data from those tables (linked). If database1 is now closed without running the make-table-queries the data in the database2 is not refreshed. I just wanted to make it very very easy for the user not to forget the update in database1. :D
 
a hidden form is just a form with its visible property set to false.

You should be able to do the things you mention when closing a form. Perhaps unload is too late - perhaps it needs to be in the last forms close event.
 
I tried the event on Unload and it's now working. But the funny thing is I cant see anything in the properties which points to the visibility? Is it possible that this property is not always available in a form?
 
yes, ive just checked - perhaps its not a design mode property for forms, unlike controls, just a run-time

you can set it in docmd.openform - one of the sections allows achidden, or directly formname.visible = false
 
Oh. I understand. Can you maybe provide me with the full code as I'm only a rookie with VBA
 
I got a compile error: Mehtod or data member not found.

This is my code

Private Sub Form_Load()
Me.frm_not_close.Visible = False
End Sub


What can I do?
 
youve stipulated the form with the wrong syntax
just

Private Sub Form_Load()
Me.visble = False
End Sub

will work. However, you will see flickering as the form will open visible and then become not visible. If this is OK then no problem, otherwise open it from another form already hidden.
 
I'm sorry. The code you gave me I already tried earlier. I didn't work as well. And because I have no other hidden form I can't open this one from a hidden from. I still lost...please. What is wrong with my code. The form is still visible...
 

Users who are viewing this thread

Back
Top Bottom