Prevent 2nd New Record line in form



I am using a form (in add records mode) - normal view - to add records to my
table. However, I would like to be able to add only one record at a time and
prevent the form from creating a new record line underneath once I start to
type data in the first record. The only way the user should be able to add
another record should be by closing a reopen the form or Refresh/Requery (I
know how to refresh and requery but I don’t know how to prevent the
creation/view of the extra line)

Any good suggestion?

Thank you,


If you set the form's Default View property to Single Form, set its
Navigation Buttons property to No, and set the Data Entry property to Yes, it
should show just one record at a time and prevent the user from going to
previous records.



You can use the "AllowAdditions" property of the form. I suggest to use it
in the "BeforeUpdate" event of the form:
Private Sub Form_BeforeUpdate()

Me.AllowAdditions = False

End Sub


Option Compare Database
Option Explicit
Dim blnNewRecord As Boolean

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

Private Sub Form_AfterUpdate()
If blnNewRecord = True Then
Me.AllowAdditions = False
blnNewRecord = False
End If
End Sub

Al Campagna

Create 2 subforms against the same table/query.

One in Continuous with Allow Add = No which could display any number of records in the
recordset. Set Edit, Add, Delete, etc... = YES, but Add New = NO
Using that same subform design (renamed) make a second subform with DataEntry = Yes
(turn off Edit,Add,Delete, Etc..) and set the view to SingleForm. Make that subform one
record high.

Here's a visual...
Sub2---------Single/DataEntry = Yes-----------------------
New record here

Now, after entering a complete new record in the lower subform, requery the continuous
subform, and that just added data should appear in the upper continuous subform.
You will not see a new record being created as you enter data, but when you're done
with that record, a blank new record will take it's place in the lower subform. That
should be a suitable solution.
If you are insistent on not seeing that next new record, then you could hide the
subform after a record was added, and create a button to show it when you wnat to add
another new record... or some other solution like that. Closing and opening the form is a
bit clumsy.

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