Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1806
  • Last Modified:

Hide Database window from vba

How can I hide the database window in a Microsoft Access project 2010 from vba?

let's say I have 2 forms opened (Overlapping windows).
Now I need to hide the database window.
When I run the following code:
    DoCmd.SelectObject acTable, "tblReceiption", True
    DoCmd.RunCommand acCmdWindowHide
    Application.CommandBars.DisableAskAQuestionDropdown = True

Open in new window


one of the forms closes.
one more time running this code, closes the second form.
If I run the code one more time, finally the database window hides.

how can I hide the database window without effecting the opened forms?

any kind of input would be appreciated.
0
MnInShdw
Asked:
MnInShdw
1 Solution
 
peter57rCommented:
To hide the Access window you must design your forms as pop-up.( I assume you mean the Access application window as A2010 does not have  what is known as the  database window)

There are  callable procedures at the following links..  

http://access.mvps.org/access/api/api0019.htm
or
http://www.peterssoftware.com/winmanip.htm


I haven't tried either of these with A2010 but they worked in A2003.
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Just to be clear:

Access 2010 does not have a Database Window. It uses the Navigation Pane. If you're trying to hide that, then let us know.

If you're not, then please clarify exactly what you mean by "database window", and what you're trying to accomplish.
0
 
peter57rCommented:
Ah - good point Scott - I might  have made the question more complicated than it really is.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
MnInShdwAuthor Commented:
sorry for the confusion.
Though I've been moved to access 2010 (from 2003) for more than a year,
still I'm misusing the definitions.

I actually need to hide the navigation pane in Access 2010, without any forms being closed.


thank you.
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Is this an MDB or ACCDB ... in A2010 ?

mx
0
 
MnInShdwAuthor Commented:
In fact it's a project (adp) as I mentioned in my first post.
But a solution for an .accdb file would be OK too.

thank you.
0
 
peter57rCommented:
You can just hide it in settings..

File >Options>Currentdatabase
Uncheck 'Show Navigation Pane'
0
 
MnInShdwAuthor Commented:
You can just hide it in settings..

I'm aware of this option.
As in my first request, I'm looking for a vba solution.

thank you
0
 
peter57rCommented:
Well you have to bear in mind that this is a STARTUP setting.  What prevails at startup is what applies throughout.  So to see the effect of changing the setting you have to close and re-open the database.

The code to hide the nav pane  is..

CurrentProject.Properties.Add "Startupshowdbwindow", False

Not obvious I know but in an adp Access doesn't  know about the property unless you create it.
0
 
peter57rCommented:
Sorry - went off on a tangent there and forgot the original question.

All you need to do is select something in the Nav Pane and you can then hide it.

Like...

DoCmd.NavigateTo "acNavigationCategoryObjectType"
DoCmd.RunCommand acCmdWindowHide
0
 
MnInShdwAuthor Commented:
DoCmd.NavigateTo "acNavigationCategoryObjectType"
DoCmd.RunCommand acCmdWindowHide

I tested it in a accdb file.
Still it closes the forms first.
If I have 2 forms opened, I have to run it 3 times. the first 2 times
closes a form.
When there's no form opened any more, the nav pane hides.

How can I hide only the nav pane without closing the forms?


thank you.
0
 
peter57rCommented:
I can't explain that.
For me it closes the Nav pane and leaves everything else alone (I'm testing in an adp).

How are you running the code?
0
 
MnInShdwAuthor Commented:
I was running it by pushing F5 in vba. (just for testing)
For some weird reasons it kept closing the opened forms.
But it seems that it works perfectly now.

thanks for your help and time.
0
 
MnInShdwAuthor Commented:
million thanks
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now