Results 1 to 6 of 6

Thread: whats the problem?

  1. #1
    imastupidguy
    Guest

    whats the problem?

    Private Sub form_keypress()
    If Keycode = vbKeyA Then
    Command20_Click
    End If
    End Sub

    error:

    procedure decloration does not match description of event or procedure having the same name

    Private Sub form1_keypress()
    If Keycode = vbKeyA Then
    Command20_Click
    End If
    End Sub

    however has no error but does nothing.

  2. #2
    Frenzied Member Skitchen8's Avatar
    Join Date
    Feb 2001
    Location
    Binghamotn, NY
    Posts
    1,943
    because keypress() isn't the correct event name... try

    Private Sub Form_KeyPress(KeyAscii As Integer)
    If keyascii = vbKeyA Then
    Command20_Click
    End If
    End Sub
    Government is another way to say better…than…you.
    It’s like ice but no pick, a murder charge that won’t stick,
    it’s like a whole other world where you can smell the food,
    but you can’t touch the silverware.
    Huh, what luck. Fascism you can vote for.
    Humph, isn’t that sweet?
    And we’re all gonna die some day, because that’s the American way
    -Stone Sour

  3. #3
    imastupidguy
    Guest
    works, but i have to press shift + a for it to work. even with the A being lowercase in the code. (i thought it may have been the uppercase) know why?

  4. #4
    Frenzied Member Skitchen8's Avatar
    Join Date
    Feb 2001
    Location
    Binghamotn, NY
    Posts
    1,943
    no, my code worked perfectly fine for me... i tried it before i posted
    Government is another way to say better…than…you.
    It’s like ice but no pick, a murder charge that won’t stick,
    it’s like a whole other world where you can smell the food,
    but you can’t touch the silverware.
    Huh, what luck. Fascism you can vote for.
    Humph, isn’t that sweet?
    And we’re all gonna die some day, because that’s the American way
    -Stone Sour

  5. #5
    imastupidguy
    Guest
    thats odd. ill just prompt caps lock usage. no biggie.

    thanks

  6. #6
    Frenzied Member moinkhan's Avatar
    Join Date
    Jun 2000
    Location
    Karachi, Pakistan
    Posts
    2,011
    vbKeyA value is 65, for 'a' use
    if KeyAscii = 97 then
    ' do something
    end if

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