Stop advancing in form with the "next" arrow at end of "list"

  • Thread starter Thread starter Duchess
  • Start date Start date
D

Duchess

I have an editable form for users where they can query by date, etc.
However, the next entry arrow allows them to advance beyond the result. For
example, if their query resulted in 1 of 4, they can still click to 5, 6, and
so on which only adds blank lines to the database table. How do I set this
to stop at the last entry of their original query?
 
You can cancel adding new records like this:

Private Sub Form_BeforeInsert(Cancel As Integer)
Cancel = True
End Sub


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
I have an editable form for users where they can query by date, etc.
However, the next entry arrow allows them to advance beyond the result. For
example, if their query resulted in 1 of 4, they can still click to 5, 6, and
so on which only adds blank lines to the database table. How do I set this
to stop at the last entry of their original query?

Set the AllowAdditions property of the form to No.

You may also want to have at least one field in the table Required, to prevent
the addition of blank records.
 
In addition to John's suggestion of making at least one field required,
setting AllowAdditions to No, can ause problems if there are no records
matching the search.
The details section can go completely blank. You can cancel the before
insert event and still leave AllowAdditions set to Yes.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
Back
Top