Where in my code can i insert a msgbox to tell the user that only numbers are allowed? I put the code in keypress but its not working. Where do you think should i put this code?

Option Explicit
Private Declare Function GetWindowLong& Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long)
Private Declare Function SetWindowLong& Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long)
Private Const ES_NUMBER = &H2000&
Private Const GWL_STYLE = (-16)

Private Sub AccsNo_Keypress()
Dim tmpValue&
Dim fAlignment&
Dim ret&
Dim flag
fAlignment& = ES_NUMBER
tmpValue& = GetWindowLong&(AccsNo, GWL_STYLE)
If flag Then
tmpValue& = tmpValue& Or ES_NUMBER
Else
tmpValue& = tmpValue& And (Not ES_NUMBER)
End If
ret& = SetWindowLong&(AccsNo, GWL_STYLE, tmpValue& Or fAlignment&)
End Sub


I badly need a reply soon...

shei