Cancel Button

  • Thread starter Gaetanm via AccessMonster.com
  • Start date
G

Gaetanm via AccessMonster.com

I have a form 1 combo box, Txtbox derived from combo box,
and another textbox for data imput. I'm trying to setup a cancel button that
would clear the enteries witjout saving and then close.

this is what i did so far on the cancel button 1 click

If Me.Dirty Then
Me.Undo
End If

I get Run-time error 2455

You enterd an expression that has an invalid reference to the property Dirty

The button property CANCEL is set to yes

Any Ideas

Thanks

Gaetanm
 
A

Allen Browne

The Dirty property applies to bound forms only.
If the code says it is not a valid property, the form is unbound.

In general, it is much better to use the Undo button on the toolbar than try
to program one on your form. Before Access allows the focus to move to your
Cancel button to process its Click event, it will process the control that
already has focus. If the data is not valid (e.g. you typed only part of a
date, or you have something in a Number field that is not a number), Access
won't let you out of the box until you fix it, so the Undo button doesn't
get to do its stuff.
 

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