Form Events

  • Thread starter Stephen @ ZennHAUS
  • Start date
S

Stephen @ ZennHAUS

Hi Guys and Gals

Can anyone tell me which form event occurs when I press escape to back out
of changes to a record?

Thanks

Stephen @ ZennHAUS
 
J

Jeanette Cunningham

Hi Stephen,
pressing Esc is similar to the undo event.
A control has an undo event which clears any edit to the control.
A form has an undo event which clears any edit to the record.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
S

Stuart McCall

Stephen @ ZennHAUS said:
Hi Guys and Gals

Can anyone tell me which form event occurs when I press escape to back out
of changes to a record?

Thanks

Stephen @ ZennHAUS

Form_Undo
 
S

Stephen @ ZennHAUS

But neither of those events are firing when I press escape to clear/undo
changes to a record. The record clears or reverts back to its original data,
but the events don't seem to fire. I am using Access 2003 BTW.

What I am trying to achieve is this:

When the contents of a combobox changes to an item with "TR" as the first
two characters, make two other controls not visible. If the controls
already are invisible and something other than a "TR" item is chosen, make
the controls visible again.

What is not working is this:

When the record that starts out as say an "SC" is being edited, if the
controls is changed to a "TR" item (which makes the controls invisible) then
ESC is used to back out of that change, the controls never reappear.

I have used both the Form_Undo and the Control_Undo events and neither fires
when ESC is pressed.
 
S

Stephen @ ZennHAUS

But neither the form_Undo or Control_Undo events are firing when I press
escape to clear/undo changes to a record. The record clears or reverts back
to its original data, but the events don't seem to fire. I am using Access
2003 BTW.

What I am trying to achieve is this:

When the contents of a combobox changes to an item with "TR" as the first
two characters, make two other controls not visible. If the controls
already are invisible and something other than a "TR" item is chosen, make
the controls visible again.

What is not working is this:

When the record that starts out as say an "SC" is being edited, if the
controls is changed to a "TR" item (which makes the controls invisible) then
ESC is used to back out of that change, the controls never reappear.

I have used both the Form_Undo and the Control_Undo events and neither fires
when ESC is pressed.
 
J

Jeanette Cunningham

That is correct, there is not any direct link between pressing Esc and Undo.
What can help is the after update event for the combo.
After user changes the value of the combo, when user clicks on another
control or a button, the after update event for the combo fires.
This is where you can check if user chose TR from the combo.

If Me.NameOfCombo = "TR" Then
Me.NameOfControl.Visible = False
Else
Me.NameOfControl.Visible = True
End If

Replace NameOfCombo and NameOfControl with the real names.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 

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

Top