What is the form name of the Database Window?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have to following code to hide the Database Window when I press the H key,
but without the name Access has given to the Database Window I can't shift
focus to it automatically to hide it. Can anyone help me out?

Also how could I have the code working on a Ctrl+x keypress?

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyH Then
DoCmd.SelectObject acForm, ,True
CommandBars("Menu Bar").Controls("Window"). _
Controls("Hide"). _
accDoDefaultAction
Forms!frm_Main.SetFocus
End If
End Sub

--
Adam Thwaites
Access Database Designer
Manchester, UK
(I have no access to other sites apart from microsoft.com so posting
external links is no use to me)
 
After your SelectObject line, try:
RunCommand acCmdWindowHide
 
Works like a charm, thanks.

Do you know how to do a KeyDown event for more than one keys?
ie Ctrl+K
--
Adam Thwaites
Access Database Designer
Manchester, UK
(I have no access to other sites apart from microsoft.com so posting
external links is no use to me)
 
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyK And Shift = acCtrlMask Then
...
End If
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

Back
Top