Disable keyboard

  • Thread starter Thread starter Martin
  • Start date Start date
M

Martin

Hi

I have two controls on a form that I am using conditional formatting to show
the days of the week in certain colours. Becuase I am using conditional
formatting I understand the controls have to be enabled and not locked.
However I dont want the user to be able to delete any of the data.

Is there a way to disable any keybaord commands if the user happens to click
on the control? Or am I approaching this in the wrong way?

Any help would be greatly appreciated. I have tried to research this but
can't seem to find any answer.

Martin
 
I don't know why you say that the control has to be enabled and not locked.

Access 2003:

I just applied conditional formatting to a control that is locked and is not
enabled and the conditional formatting worked.

I changed to control to not locked and not enabled and conditional formatting
worked.

I changed the control to locked and enabled and conditional formatting worked.

The other option is to cancel any changes made to the control using the before
update event.
Private Sub fSubject_BeforeUpdate(Cancel As Integer)
Cancel = True
End Sub

Another option might be to use the keyup event and reset the keycode to zero.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
I'm just taking a guess here, but if you were to put in your BeforeUpdate
event of the said controls a Cancel = True with no conditions, then the data
would never be updated...

Private Sub Controlname_BeforeUpdate(Cancel As Integer)
Cancel = True
End Sub

maybe there's a more appropriate way but this should certainly work

hth
--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 
Back
Top