Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2007
    Posts
    16

    Unanswered: On screen Keyboard In access

    Hi All,

    I am wandering if anyone can give me a hand on this, basically i am trying to create an on screen keyboard to be used with a touch screen and would appreciate if anyone has any know how of how to do this or any sample db they can provide me with.

    the keyboard will have the basic features with the letters a space bar a backspace button etc nothing too complicated like caps lock on etc.

    Thanks in advance

  2. #2
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    I believe you want to utilize the KeyDown event for the form and then test for what KeyCode is pushed.

    For example:
    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

    If KeyCode = vbKeyEscape Then ....
    If KeyCode = vbKeySpace then ....
    If KeyCode = vbKeyBack then ...

    End Sub

    Also, if you put the & in the Caption (ex: &Close) of a button, if the user holds down the Alt Key and then pushes (the C for example), the button for the &Close (ex: cmdClose) will execute.
    Last edited by pkstormy; 11-19-07 at 23:04.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  3. #3
    Join Date
    Nov 2007
    Posts
    16
    Hi,
    Thanks pkstormy for your reply, how would it know which key down to look for also how would i be able to write a full sentance with it.

  4. #4
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Not sure what you mean here. The easiest way to program for the keycode is to test for what keycode is pushed by doing a msgbox KeyCode in the Key down procedure (or look up the keycodes in the help):

    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    msgbox "You pushed the: " & Chr(KeyCode) & " key."
    End Sub

    Then you can program something when that key is pushed:
    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    if KeyCode = 65 then msgbox "You pushed the A key"
    End Sub

    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    if KeyCode = 65 then
    'Put your code in for the A key here...
    End If
    End Sub
    or
    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    select case KeyCode
    Case 65
    'Put your code in for the A key here...
    case 75
    ....
    End Select
    End Sub

    To write a sentence, you might define a variable as a string (or variant) and add to it....
    Dim SomeString as string <- put this under the option compare database

    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    SomeString = SomeString & Key(KeyCode)
    msgbox "You've typed: " & SomeString
    me.SomeLabel.Caption = SomeString
    end Sub

    (Note: you may have problems with the keycode procedure if you have Text boxes, command buttons, etc.. verses labels on your form.)
    Last edited by pkstormy; 11-19-07 at 23:30.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  5. #5
    Join Date
    Nov 2007
    Posts
    16
    Hi,

    Thanks Pkstormy for the reply i think i get you but am going to test it out tomorrow and get back to you.

    Thanks for the example.

    Regards
    Neemo

  6. #6
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    I added some more to my post above. Not sure if you caught the bottom part of my post.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

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