Results 1 to 4 of 4
  1. #1
    chiaro59 is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2014
    Posts
    14

    Invio per discesa elenco della casella combinata

    Buongiorno,
    vorrei ottenere questo effetto per essere pił veloce.


    su una casella combinata, alla pressione del tasto invio con casella vuota vorrei avere la discesa dell'elenco.
    Grazie per l'aiuto.

  2. #2
    cyanidem's Avatar
    cyanidem is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2015
    Location
    Consett, UK
    Posts
    270
    Code:
    Private Sub YourCombo_KeyDown(KeyCode As Integer, Shift As Integer)
        If KeyCode = vbKeyReturn Then
            ' Ignore this key so it's not moving focus to the next control
            KeyCode = 0
            YourCombo.Dropdown
        End If
    End Sub

  3. #3
    chiaro59 is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2014
    Posts
    14
    Va bene, ma non riesco pił ad andare al controllo successivo.
    Ho provato anche ad eliminare la linea "KeyCode=0" ma non funziona.

  4. #4
    cyanidem's Avatar
    cyanidem is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2015
    Location
    Consett, UK
    Posts
    270
    Sorry, I don't speak italian, I used google translate to understand what you're asking for As far as I understand now you have problem with not moving to next control after pressing ENTER when there's value selected in combobox.
    Default behaviour of ENTER key is to move to next control so you need to override it if you want to use ENTER to dropdown your combobox. Now you have 3 options:
    1. Change your code a bit to:
    Code:
    If KeyCode = vbKeyReturn And (Me.YourCombo.Value = "" Or IsNull(Me.YourCombo.Value)) Then
    2. Use TAB to move to next control on form
    3. Use LEFT ALT + ARROW DOWN to expand combobox (instead of ENTER)

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Tasto Esc della tastiera
    By sergran in forum Programming
    Replies: 3
    Last Post: 09-10-2013, 01:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums