Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

why is this If statement not working

Status
Not open for further replies.

chiefvj

Technical User
Feb 4, 2005
73
US
Private Sub combo_sport_KeyPress(KeyAscii As Integer)

Dim TheKey As String
TheKey = KeyAscii

If TheKey = "324" Then
' if the user hits the space bar
' check for the ascii code 324
MsgBox ("We are in a space " & combo_sport)
Else
MsgBox ("keyascii= " & KeyAscii & vbYesNo)
End If

End Sub




thx in advance
 
To check for the space bar I'd simply use this:
If KeyAscii = 32 Then
...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top