Deleting Last Record?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that is normally populated with records from a table based on a
query. I have a new requirement that would allow the form to be a "New
Record" that they could enter information and save to the table that is
mentioned above. My problem is unless they finish entering data, I would like
this record to NOT be saved to the table. Is there a delete last record, or
is there a better way to do this. The table is replicated so the ID's are
random.
Thanks
 
sturner333,
Why not just make each field Required. The record can not be saved untill all fields
are filled in.
 
Actually I have tried to look at key fields and require that they are filled
in The problem is once any field is entered, the new record seems to have
been recorded. I have no problem if they do not enter any data.
Thanks
 
If you want to avoid adding the current record (the one you are editing) to
the underlying table(s), you can use:
Me.Undo
And all changes will be discarded. The trick will be determining whether to
keep the record or not. I would use the Before Insert event of the form to
look at the fields and see whether or not it should be kept.
 
If I understand correctly...
In addition to Klatuu's response, make sure that you have no Refresh or Requeries
involved, as you enter data. That saves the record immediately.

Go to your table, and make all fields required. If something in the form is causing a
Save, and any fields are not filled in, you should know right away where it's occuring.
Once a Refresh or Requery has occured, there's no chance for an Undo.
 
In addition to all of the other situations mentioned in this thread,
be aware that the subform-associated record is automatically saved if
you move from a subform to the main form (or to another subform) and
that the main form associated record is automatically saved if you
move from the main form to a subform. This is often unintuitive, in
terms of the order of data item entry, and must be borne in mind in
defining complex form/subform structures.

If I understand correctly...
In addition to Klatuu's response, make sure that you have no Refresh or Requeries
involved, as you enter data. That saves the record immediately.

Go to your table, and make all fields required. If something in the form is causing a
Save, and any fields are not filled in, you should know right away where it's occuring.
Once a Refresh or Requery has occured, there's no chance for an Undo.

Please respond to the Newsgroup, so that others may benefit from the exchange.
Peter R. Fletcher
 
Peter,
That's a good point, and worth mentioning, but my "all required" fields table would
catch that update. For problem determination, that "trap" should spring on any update
that the poster might not be aware of.
Since a subform was not indicated, I assumed a single form. I took it to be a "I enter
a couple of fields, realize a problem, but can't Undo" type of problem.
Thanks,
 
Back
Top