Connecting Tech Pros Worldwide Forums | Help | Site Map

Database Window Currently Showing

NeoPa's Avatar
Administrator
 
Join Date: Oct 2006
Location: London - UK
Posts: 15,730
#1: Jan 28 '09
Does anyone know where I could find the visible status of the Database Window (from code)?

I have code to hide it specifically, but to hide it, one must first select it, which shows it. This causes it to flash briefly on the screen (if it was already hidden) and frankly, looks unprofessional.
Expand|Select|Wrap|Line Numbers
  1. Call DoCmd.SelectObject(ObjectType:=acForm, InDatabaseWindow:=True)
  2. Call DoCmd.RunCommand(Command:=acCmdWindowHide)

Moderator
 
Join Date: Feb 2008
Location: Beauly, near Inverness, Scotland
Posts: 1,576
#2: Jan 28 '09

re: Database Window Currently Showing


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
puppydogbuddy's Avatar
Expert
 
Join Date: May 2007
Location: Florida
Posts: 1,915
#3: Jan 28 '09

re: Database Window Currently Showing


Hi Adrian and Stewart,
If I recall correctly, the InDatabaseWindow argument of the select object statement can be set to False to hide the db window as shown below:

DoCmd.SelectObject acForm, "Any Form in YourDB", False

pDog
mshmyob's Avatar
Expert
 
Join Date: Jan 2008
Location: witness protection
Posts: 618
#4: Jan 28 '09

re: Database Window Currently Showing


Check this link out.

http://www.mvps.org/access/api/api0069.htm

cheers,
NeoPa's Avatar
Administrator
 
Join Date: Oct 2006
Location: London - UK
Posts: 15,730
#5: Jan 28 '09

re: Database Window Currently Showing


Quote:

Originally Posted by Stewart Ross Inverness View Post

-Stewart

Hi Stewart. Thanks for this.

I am already setting the StartupShowDBWindow property manually, but I can change that if/when needed from code. I can also hide and unhide the database window from code when necessary (I use this in certain circumstances).

My intention is to run the "Hide database window" code only when it's currently showing, as when it is run in the situation where the database window is already hidden, it causes a noticeable flicker. Hence I need to check this status before running the code.

Showing the db window is never a problem, just having to show it before hiding it is a little messy.

I really appreciate your spending your time to help. And that goes for all who've posted too of course.
NeoPa's Avatar
Administrator
 
Join Date: Oct 2006
Location: London - UK
Posts: 15,730
#6: Jan 28 '09

re: Database Window Currently Showing


Quote:

Originally Posted by puppydogbuddy View Post

Hi Adrian and Stewart,
If I recall correctly, the InDatabaseWindow argument of the select object statement can be set to False to hide the db window as shown below:

DoCmd.SelectObject acForm, "Any Form in YourDB", False

pDog

I believe that shows the named form pDog, rather than the database window. If the parameter is true it simply shows the database window but with the specified object selected.

I'm really not trying to sound ungrateful here. I do appreciate all comments :)
NeoPa's Avatar
Administrator
 
Join Date: Oct 2006
Location: London - UK
Posts: 15,730
#7: Jan 28 '09

re: Database Window Currently Showing


Quote:

Originally Posted by mshmyob View Post

Check this link out.

http://www.mvps.org/access/api/api0069.htm

cheers,

This looks like something I can build on mshmyob.

It also confirms my suspicion that this particular facility is NOT provided by Access itself (for some reason).

I will do some further digging and see if I can understand exactly how it's working and come up with some code of my own I'll be able to post :)
Reply

Tags
database, visible, window


Similar Microsoft Access / VBA bytes