removing cursor (focus) from a null field

  • Thread starter Thread starter bretheren
  • Start date Start date
B

bretheren

hi peers,

okay this is a bit of a tricky situation to explain but i'll try to be
as simple as possible.

i have a data entry form (bound to a table) with CANCEL and SAVE
buttons. some of the fields i have on this form are required and others
are optional. my problem is to do with the required fields.

although the scenario is somewhat unlikely but i want to be able to
handle it through code. so here it is:

how do i move cursor from a required field AFTER it has been changed.

if the above line makes sense to you, then you don't need to read any
further...but if you'd like to know what exactly i'm talking about then
please keep reading.

/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*
let's say user is doing some basic data entry and types the wrong data
in one of the required fields. for instance DATE is a required field
and user types in "Car". while doing that, he changes his mind and
clicks on CANCEL to get out of the form. as soon as he click on CANCEL
button (or any other field for that matter) he gets the standard access
error message complaining about invalid data. he deletes "Car" from the
field and clicks CANCEL but this time he gets an error message
complaining about the null value.
/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*

so after all that explaining (and i hope it was understandable) what
i'd like to do is be able to press the CANCEL button and get out of the
form.

any help will be appreciated.
 
As I understand you, what you are trying to accomplish is to escape from the
record. Pushing the escape button twice will take you back to a clean empty
record, or return you to where the record was when you started to edit it.
Keep in mind, that the record is saved if you move to a subform (or
visa-versa).

You can accoumplish the same thing as the above in your code by adding the
following line to your Cancel button, before you discard the record:

Me.Undo
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Back
Top