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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass KeyAscii To Function from Property Page 1

Status
Not open for further replies.

PWise

Programmer
Dec 12, 2002
2,633
US
See my privious post

I would like to create a function for the OnKeyPress Event
for many controls and have the value of the of Keyascii passed to the function

On Key Press =ReplaceSpace(KeyAscii)

Code:
Function ReplaceSpace(KeyAscii)
If KeyAscii = 32 Then
    KeyAscii = 160
Else
    KeyAscii = KeyAscii
End If
End Function

Instead of having to create this code for each control


Code:
Private Sub VStaffLastName_KeyPress(KeyAscii As Integer)
If KeyAscii = 32 Then KeyAscii = 160

End Sub
 
Have a look at KeyPreview for the form. It should allow you to get the key press for the form, rather than any particular control.
 
Seems to work have another pink one.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top