Cancel Add Mode with Required Fields

P

Piperlynne

I have a form that puts the user into data entry mode when they click a
command button. But I want to have the ability for the user to cancel that
mode if they need to go look something else up.
There are required fields in the table the form is writing to. If the user
wants to cancel at this point, they have to close the entire database. Help!!
 
J

John W. Vinson

I have a form that puts the user into data entry mode when they click a
command button. But I want to have the ability for the user to cancel that
mode if they need to go look something else up.
There are required fields in the table the form is writing to. If the user
wants to cancel at this point, they have to close the entire database. Help!!

They can hit the <Esc> key twice (once to cancel the entry for the control
that has the focus, the second time to cancel the entire record). If you
prefer, you can put a "Cancel" button on the form which cancels the entry:

Private Sub cmdCancel_Click()
Me.Undo
End Sub

Or use a Macro with Undo as its action.
 

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