What is the form name of the Database Window?

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)
 
G

Guest

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)
 
R

Ron Hinds

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

Top