Hi NeoPa. I have not found any property which reflects the current visibility status of the database window that could be toggled in real time to show or hide the window. There is no indication of any such property available within Access in any of the sources I've trawled so far (including MSDN and the MS knowledge base).
As I'm sure you know the norm in hiding the database window is to untick the Display Database Window tickbox in the Tools, Startup options of the database. Doing so sets the
StartupShowDBWindow property in the Properties collection of the CurrentDB object which is available in code (see for example MSDN article
http://msdn.microsoft.com/en-us/libr...ffice.10).aspx).
The current value can be shown in the immediate window of the VBE by typing
? CurrentDB.Properties("StartupShowDBWindow")
This property can be set True or False in VBA, but any change does not take effect until the next startup, and is no different to ticking or unticking the option in the Tools, Startup window anyway.
The only other option I know of to hide the window is to use an Autoexec macro to do so on startup - but the need for this use of autoexec was really superseded when the Display Database Window property was made available as part of the startup options from A2000 on I guess.
I know you are seeking a means of hiding the window without using the selection method that you show in your question first. Perhaps you are running a process that has led to the DB window becoming visible (for example, by reattaching tables), so you need to hide it again. So far, the method you are using is very similar to those recommended by other Access experts such as Allen Browne for this purpose.
-Stewart