Link to home
Start Free TrialLog in
Avatar of BobRosas
BobRosas

asked on

record a keystroke

When the user initiates "keydown" for the txtSSName field, I want the keystroke rembered and added to a dropdown field where it will start auto filling.  This is what I have so far and keycode appears to be a numeric value for the letter entered and it is not working.  I'm connected to a SQL db if that helps.

Objective:  What I want is for the txtSSName to display the Support Staff(SS) for the current client.  However, if the user clicks on txtSSName I want to go to a dropdown field where only the CURRENT SS names are listed.  If I use only the combo box for my form (and filter out Non Current names)  the name doesn't display on the form if the SS is not current.  If there is a better way to do this I'm open for suggestions.  Right now I'm displaying txtSSName field on top of cboSupportStaffLkUpID.

Private Sub txtSSName_KeyDown(KeyCode As Integer, Shift As Integer)
    strKeyCode = KeyCode
    DoCmd.GoToControl "cboPlacementFollowUpBy"
End Sub

Private Sub cboSupportStaffLkUpID_GotFocus()
    cboSupportStaffLkUpID.SelText = strKeyCode
End Sub
ASKER CERTIFIED SOLUTION
Avatar of MikeToole
MikeToole
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If the comboBox list is:
h
hn
hna
hnas

Do you want when typing h the combo to display h
              and when typing hn the comboBox to display hn, and so on
Avatar of BobRosas
BobRosas

ASKER

Thank you both for your responses.  chr(Keycode) did change the value to what I typed in so I"d be glad to close this question but since it didn't solve my problem I'd be glad to increase points for some continued help.  
In previous testing when I would type in "hnas" for example.  It would display "nas".  It kept leaving off the first letter.  So I thought if I saved off the first letter the rest would work.  However now I get the error "The text you entered isn't an item in the list."  (Even when it is.) Any thoughts?
I want to clarify that when I get the message "The text you entered isn't an item in the list."  The first letter (Ex: "H") is the only thing in the field.  So I guess technically that doesn't exist as a choice but that's why I used .selText.  I'm just trying to initiate the auto fill. But somehow I think it's accepting it as the whole entry.  I'd apprecaite any input.
Thanks
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I think I got it working.
Thank you so much for your patience!