Revealing the Database Window

G

Guest

I've set up an Access menu form that activates when the file is opened and
guides the user (potentially non-computer literate) through common data
manipulation tasks, automating as much as possible.

In order to keep the screen as free from confusing clutter as possible, I
have the database window set to be invisible at startup.

What is the best way to make the window visible again, should the user
choose to exit the menu? So far, the only way I'm aware of is to SendKeys
"{F11}", but for various reasons, this is an unsatifying approach
(specifically, it's causing me a headache I'm trying to resolve in the
"Distinguishing root cause of Form_Close event" thread). Is there another
way to make this window visible programatically?
 
G

Guest

Hi, Michael.

Place a button on a form, and the user will be able to toggle the Database
Window from visible to hidden. Try:

Private Sub ShowDBWinBtn_Click()

On Error GoTo ErrHandler

Static fShow As Boolean

DoCmd.SelectObject acForm, Me.Name, True

If (Not (fShow)) Then
RunCommand acCmdWindowHide
End If

fShow = Not (fShow) ' Toggle setting for next time.

Exit Sub

ErrHandler:

MsgBox "Error in ShowDBWinBtn_Click( ) in" & vbCrLf & _
Me.Name & " form." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & Err.Description
Err.Clear

End Sub

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.
 
G

Guest

That works like a charm, but if you don't mind me asking, why does the
DoCmd.Select Object select the database window? It intuitively looks like it
should be selecting the form the button is on rather than bring the database
window to the fore.
 
M

Marshall Barton

Michael Suttkus said:
I've set up an Access menu form that activates when the file is opened and
guides the user (potentially non-computer literate) through common data
manipulation tasks, automating as much as possible.

In order to keep the screen as free from confusing clutter as possible, I
have the database window set to be invisible at startup.

What is the best way to make the window visible again, should the user
choose to exit the menu? So far, the only way I'm aware of is to SendKeys
"{F11}", but for various reasons, this is an unsatifying approach
(specifically, it's causing me a headache I'm trying to resolve in the
"Distinguishing root cause of Form_Close event" thread). Is there another
way to make this window visible programatically?


You might find these little procedure helpful:

Function HideMenu()
DoCmd.ShowToolbar "Menu Bar", acToolbarNo
End Function

'Show it, with:

Function ShowMenu()
DoCmd.ShowToolbar "Menu Bar", acToolbarYes
End Function

Sub HideDbWindow()
DoCmd.SelectObject acTable, , True
DoCmd.RunCommand acCmdWindowHide
End Sub

Sub ShowDbWindow()
DoCmd.SelectObject acTable, , True
End Sub
 
G

Guest

Ah, I get it now, thanks to both of you!

Marshall Barton said:
You might find these little procedure helpful:

Function HideMenu()
DoCmd.ShowToolbar "Menu Bar", acToolbarNo
End Function

'Show it, with:

Function ShowMenu()
DoCmd.ShowToolbar "Menu Bar", acToolbarYes
End Function

Sub HideDbWindow()
DoCmd.SelectObject acTable, , True
DoCmd.RunCommand acCmdWindowHide
End Sub

Sub ShowDbWindow()
DoCmd.SelectObject acTable, , True
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top