Results 1 to 7 of 7

Thread: [RESOLVED] how to capture multiple key strokes at once

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Location
    Botswana
    Posts
    107

    Resolved [RESOLVED] how to capture multiple key strokes at once

    anyone know a way to capture multiple key strokes when a form is open? when a form is open and the user presses a combination of keys at the same time (ie cntrl+j) i want an event to fire. (much like when you hit cntrl+alt+del in windows)

    microsoft access 2003
    I am using Microsoft Visual Basic 2008 Express Edition. I use Access for my data base

  2. #2
    Hyperactive Member
    Join Date
    Jun 2007
    Posts
    280

    Re: how to capture multiple key strokes at once

    Set it up as a hot key in your menu? Then you can do what you want with it.
    Slower than a crippled Vista
    More buggy than a fresh XP install
    Look! Down the road, some 50 miles behind the drunken snail.
    It's Ubuntu!

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Location
    Botswana
    Posts
    107

    Re: how to capture multiple key strokes at once

    and how do i do that?
    I am using Microsoft Visual Basic 2008 Express Edition. I use Access for my data base

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Location
    Botswana
    Posts
    107

    Re: how to capture multiple key strokes at once

    this seems to work. found this here:

    If (KeyAscii And 2) And (KeyAscii = Asc("J")) Then
    KeyAscii = 0
    MsgBox "ok"
    End If

    nevermind, that just checks for a capital leter
    Last edited by dreamdelerium; Aug 20th, 2008 at 11:53 AM.
    I am using Microsoft Visual Basic 2008 Express Edition. I use Access for my data base

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: how to capture multiple key strokes at once

    Are you doing this in a sheet or a UserForm?

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Location
    Botswana
    Posts
    107

    Re: how to capture multiple key strokes at once

    its on a form
    I am using Microsoft Visual Basic 2008 Express Edition. I use Access for my data base

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Location
    Botswana
    Posts
    107

    Re: how to capture multiple key strokes at once

    well, finally got it:

    the keydown event for the form:



    Code:
     Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    HandleKeys KeyCode, Shift
    End Sub


    call this function:



    Code:
    Public Sub HandleKeys(KeyCode As Integer, Shift As Integer)
    
        Dim ShiftDown As Integer
        Const KEY_j = 74
        Const CTRL_MASK = 2
        ShiftDown = ((Shift And CTRL_MASK) > 0)
        Select Case KeyCode
            Case KEY_j
                If ShiftDown = -1 Then
                   'do whatever here
                Else
                End If
                End Select
                KeyCode = 0
    End Sub
    Last edited by dreamdelerium; Aug 21st, 2008 at 07:22 AM.
    I am using Microsoft Visual Basic 2008 Express Edition. I use Access for my data base

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width