Event Question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I have several forms that can be in either "View" or "Edit" mode. Each
screen opens in "View" mode. I'd like a message box to pop up whenever the
user tries to enter info in any of the controls while in "View" mode, to
avoid making a change, then getting warned, and having to do it all over
again after switching to "Edit" mode.....something that drives me crazy.
What is the best event to set my code in to get this warning to pop up?

TIA

Owen
 
O said:
Hello,

I have several forms that can be in either "View" or "Edit" mode.
Each screen opens in "View" mode. I'd like a message box to pop up
whenever the user tries to enter info in any of the controls while in
"View" mode, to avoid making a change, then getting warned, and
having to do it all over again after switching to "Edit"
mode.....something that drives me crazy. What is the best event to
set my code in to get this warning to pop up?

TIA

Owen

Why don't you just open them in read only mode? Then if they try to edit
something they just won't be able to.
 
Rick,

I'd like to explain why they can't enter anything. I have a label that
says you must be in "Enter" mode, but you wouldn't believe, or maybe you
would, the number of people that still ask why nothing is happening. I was
hoping tosave a few phone calls.
 
Couple or one way i can think of.

Use the OnKeyPress Event or OnKeyDown Event of the Form.

Private Sub Form_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case KeyAscii
MsgBox "You cannot edit this record, this form is locked."
KeyAscii = 0
End Select
End Sub

Note, all keys input is disabled, leaving only your mouse function
eg close form,click button.
O said:
Rick,

I'd like to explain why they can't enter anything. I have a label that
says you must be in "Enter" mode, but you wouldn't believe, or maybe you
would, the number of people that still ask why nothing is happening. I was
hoping tosave a few phone calls.[quoted text clipped - 12 lines]
Why don't you just open them in read only mode? Then if they try to edit
something they just won't be able to.
 
Back
Top