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

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?
 
J

Jeanette Cunningham

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
 
J

John W. Vinson

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.
 
J

Jeanette Cunningham

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top