Solved

Hide Database window from vba

Posted on 2012-03-17
14
1,572 Views
Last Modified: 2012-06-21
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
Comment
Question by:MnInShdw
14 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 37734455
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
 
LVL 84
ID: 37734512
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
 
LVL 77

Expert Comment

by:peter57r
ID: 37734561
Ah - good point Scott - I might  have made the question more complicated than it really is.
0
 
LVL 1

Author Comment

by:MnInShdw
ID: 37735743
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
 
LVL 75
ID: 37735756
Is this an MDB or ACCDB ... in A2010 ?

mx
0
 
LVL 1

Author Comment

by:MnInShdw
ID: 37735964
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
 
LVL 77

Expert Comment

by:peter57r
ID: 37735998
You can just hide it in settings..

File >Options>Currentdatabase
Uncheck 'Show Navigation Pane'
0
Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

 
LVL 1

Author Comment

by:MnInShdw
ID: 37736055
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
 
LVL 77

Expert Comment

by:peter57r
ID: 37736162
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
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
ID: 37736185
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
 
LVL 1

Author Comment

by:MnInShdw
ID: 37736382
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
 
LVL 77

Expert Comment

by:peter57r
ID: 37736698
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
 
LVL 1

Author Comment

by:MnInShdw
ID: 37736897
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
 
LVL 1

Author Closing Comment

by:MnInShdw
ID: 37736899
million thanks
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now