From: Piperlynne on
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!!


From: Marshall Barton on
Piperlynne wrote:

>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!!
>

You can undo the incomplete record by adding:
Me.Undo
to the button's click event.

--
Marsh
MVP [MS Access]
From: John W. Vinson on
On Mon, 22 Mar 2010 08:45:01 -0700, Piperlynne
<Piperlynne(a)discussions.microsoft.com> wrote:

>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.
--

John W. Vinson [MVP]