undo function

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

Guest

I have a function that hides or unhides certain fields based on if a
calculated field is Yes or No.

In the underline query, I have a calculated field called "Continue" with an
IIf([field1]>[field2], "Yes", "No").

when a field is updated or a user moves from one record to another, the
event procedure runs: If [continue] = yes then certain fields are visible.
if no then certain fields are hidden.

However, if someone hits the esc button a couple times to undo their
changes, the function doesn't run. So if the the record originally had
continue = no and the user change the info so it would =yes and then they
undo the changes, the continue is still no, but the fields are still visible,
when they should be hidden.

Thanks.
 
The only place to trap that is in the *form* KeyPress event, but don't forget
to set KeyPreview to Yes.

Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyEscape Then ShowFields
End Sub

Assuming that you have a sub called ShowFields that sets the visibility of
these fields.

HTH
John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top