Checking That A Record Was Not previously Entered

  • Thread starter Thread starter TC
  • Start date Start date
T

TC

I don't have Access here to check, but I believe that the cancel & me.undo
would just undo the value entered in that field. I don't think it will undo
the creation of an unsaved new record. So you are still positioned on a new
record, no?

Do you really want to automatically >discard< the unsaved (blank) new
record, when the value entered in that field is already on file? That's a
bit non-standard, IMO. Normally you would issue a message, cancel the
beforeupdate, but >not< Undo. Then the user can amend the value & try again,
or press Esc a few times to discard the unsaved new record.

HTH,
TC
 
Sue, there's no way you can save an all-blank record. It simply does not
happen. I think that what you are seeing, is a well-known Access bug. If you
close a form by clicking the close button at the top right corner, Access
tres to save the pending new or edited record - as it should do. But if it
can not< save that record for any reason - eg. a missing mandatory field -
it discards the record >silently<, without a visible message of any kind. So
I think that what you are seeing is, the unsaved new record being discarded
silently - not saved.

Yes? No?

HTH,
TC
 
As soon as a character is entered in the first field of a new record, the number
of records shown in the navigation buttons increases by 1 and the new record
button becomes enabled. In the BeforeUpdate event of the first field, I check to
see if that value has been previously entered. If it has, I do a Cancel = True
and a Me.Undo. The number of records does not change and the new record button
is still enabled although clicking it does nothing. This is confusing! The
indicated number of records is wrong and you can not go to a new record. Is
there another way of checking that a record was not previously entered than what
I am doing in the BeforeUpdate event?

Thanks!

Sue
 
TC,

Thanks for responding!

If you don't Undo and the user closes the form without pressing ESC a few times
then a blank record is saved.

Sue
 
Even after the Me.Undo, you are still on the (blank) NewRec. You need to
make one of the existing Records the CurrentRecord of your Form.

Try moving to the last Record with:

DoCmd.GoToRecord , , acLast

after you set Cancel to True.

(tested OK in A2K)
 
Back
Top