Yes, just use code like this, and make sure the Form's KeyPreview property
is set to True. Forget about finding a constant - just use the 39. Another
option would be to check if KeyAscii = Asc("'"), which will also evaluate to
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 39 Then
KeyAscii = 0
> I am still stuck...
> Is there any other way for blocking a particular key for
> an entire form...
> I need to block the single quote ie the apostrophe key...
> I don't want to sit and write code for
> each textbox..its too cumbersome...
> > If 39 is the code, it matches the keycode constant of vbKeyRight.
> > --
> > Patrick Logan, MCSD
> > Senior Technical Development Advisor
> > McKessonHBOC -- Extended Care Solutions Group
> > Opinions expressed are my own and not necessarily those of McKessonHBOC.