Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / October 2005

Tip: Looking for answers? Try searching our database.

Get all combo boxes to drop down on arrow key with one piece of code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tony - 26 Oct 2005 17:01 GMT
Hi All,

I've got a db with lots of combo boxes and I'd like the user to be able to
scroll through the list items using the up/down arrow keys.  I'm currently
using the KeyPress event and looking for keycode = 40 to enable dropdown on
the combo box.  However, this seems cumbersome as I have to do this on the
KeyPress event for every combo box in the db.

Can anyone offers suggestions as to how I can accomplish this globally as
opposed to adding code to each combo box's KeyPress?

Thanks & Ciao,

Tony
Tony - 26 Oct 2005 17:03 GMT
Meant KeyDown, not KeyPress...

> Hi All,
>
[quoted text clipped - 10 lines]
>
> Tony
Brendan Reynolds - 26 Oct 2005 21:16 GMT
If you set the KeyPreview property of the form to 'Yes' in the Properties
window (or True if you set it in code) you can then do something like this
...

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

   If KeyCode = vbKeyDown Then
       If Me.ActiveControl.ControlType = acComboBox Then
           Me.ActiveControl.Dropdown
       End If
   End If

End Sub

BTW: Access already provides not one but two shortcuts to drop dow a combo
box - F4 and Alt+Down Arrow.

Signature

Brendan Reynolds

> Meant KeyDown, not KeyPress...
>
[quoted text clipped - 12 lines]
>>
>> Tony
Tony - 26 Oct 2005 22:32 GMT
Hey Brendan,

Thanks for the response.  I had no idea there was Form KeyDown event and
that looks promising for other 'global' things I want to accomplish.  I was
aware of the other options to drop the box, but I want to make this as
simple as possible; I was instructed to 'design it so that our execs can use
it'.  I'm sure you know how it goes...

Thanks & I'll post back to this thread if I have any further questions.

Ciao,

Tony

> If you set the KeyPreview property of the form to 'Yes' in the Properties
> window (or True if you set it in code) you can then do something like this
[quoted text clipped - 29 lines]
>>>
>>> Tony
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.