From: Lou Burgoyne on
I want to capture when the user abandons the creation of a new record by
pressing the escape key.
Using the KeyDown event does not really do what I want becasue pressing ESC
does not always abandon the new record creation. It can also be used to
abandon the data being entered in a field on the form.

Any ideas would be greatly appreciated.

Lou Burgoyne
--
Keeper of the odd jobs
From: Allen Browne on
Use the Undo event of the Form.

This kind of thing:

Private Sub Form_Undo(Cancel As Integer)
If Me.NewRecord Then
Debug.Print "New record cancelled in form " & Me.Name & " at " &
Now()
End If
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"Lou Burgoyne" <LouBurgoyne(a)discussions.microsoft.com> wrote in message
news:B31BA383-A8D9-45A9-8A1F-2351B2BAA214(a)microsoft.com...
> I want to capture when the user abandons the creation of a new record by
> pressing the escape key.
> Using the KeyDown event does not really do what I want becasue pressing
> ESC
> does not always abandon the new record creation. It can also be used to
> abandon the data being entered in a field on the form.
>
> Any ideas would be greatly appreciated.
>
> Lou Burgoyne
> --
> Keeper of the odd jobs

From: Lou Burgoyne on
Allen,

Thanks,

That was what I was looking for. It then leads me to a new question.
When the user starts entering a new record and then abandons it, I'd like
the form to show the last record in the form (which is currently sorted by
OrderNo).
"DoCmd.GoToRecord acDataForm, "frmJobOrder", acLast" leaves me on the
new record screen with none of the default values populated.
"DoCmd.GoToRecord acDataForm, "frmJobOrder", acPrevious" fails. Any
thoughts on how to display the last record in the form after a new record is
abandoned?

Thanks again.
--
Keeper of the odd jobs


"Allen Browne" wrote:

> Use the Undo event of the Form.
>
> This kind of thing:
>
> Private Sub Form_Undo(Cancel As Integer)
> If Me.NewRecord Then
> Debug.Print "New record cancelled in form " & Me.Name & " at " &
> Now()
> End If
> End Sub
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
>
> "Lou Burgoyne" <LouBurgoyne(a)discussions.microsoft.com> wrote in message
> news:B31BA383-A8D9-45A9-8A1F-2351B2BAA214(a)microsoft.com...
> > I want to capture when the user abandons the creation of a new record by
> > pressing the escape key.
> > Using the KeyDown event does not really do what I want becasue pressing
> > ESC
> > does not always abandon the new record creation. It can also be used to
> > abandon the data being entered in a field on the form.
> >
> > Any ideas would be greatly appreciated.
> >
> > Lou Burgoyne
> > --
> > Keeper of the odd jobs
>
> .
>
From: Allen Browne on
If you are at the new record, then going to the previous one should take you
back (if there is one.)

Haven't tried though: you may find that you can't move record until after
Form_Undo has finished running.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"Lou Burgoyne" <LouBurgoyne(a)discussions.microsoft.com> wrote in message
news:3B6853C1-2015-424C-8CAE-E8F0F291333D(a)microsoft.com...
> Allen,
>
> Thanks,
>
> That was what I was looking for. It then leads me to a new question.
> When the user starts entering a new record and then abandons it, I'd like
> the form to show the last record in the form (which is currently sorted by
> OrderNo).
> "DoCmd.GoToRecord acDataForm, "frmJobOrder", acLast" leaves me
> on the new record screen with none of the default values populated.
> "DoCmd.GoToRecord acDataForm, "frmJobOrder", acPrevious" fails.
> Any thoughts on how to display the last record in the form after a new
> record is abandoned?