Prevent empty "data entry" row from displaying in a table unless..

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

Guest

By default, there is an empty "row" that is displayed to add data in a table.
This row also shows up when used with a form.

Is there a way to prevent this row from displaying unless the "new record"
button is pressed?
 
In a form, you can set the form's "AllowEditions" property to False, then
set it to True when a custom "new record" button is pressed. (You can't do
this if you are using the "new record" button that's part of the built-in
navigation buttons).

In a table: no.

HTH,
 
I set the subform allowadditions property to "no".
I also added the following code lines to the add record button event
procedure on the subform.

Private Sub Add_Click()
On Error GoTo Err_Add_Click
Me.AllowAdditions = True <-new line
DoCmd.GoToRecord , , acNewRec

Exit_Add_Click:
Me.AllowAdditions = False <-new line
Exit Sub

Err_Add_Click:
MsgBox Err.Description
Resume Exit_Add_Click

End Sub

When I press the add record button, I see the new row appear but then
quickly disappear. What am I missing?

TIA
 
When I press the add record button, I see the new row appear but then
quickly disappear. What am I missing?

Setting AllowAdditions to False means just that: no additions allowed.
It doesn't matter whether you've transiently displayed the new record
or not.

Set the AllowAdditions property back to False in the Form's
AfterInsert event.

John W. Vinson[MVP]
 
Ok. That worked.
thanks.

John Vinson said:
Setting AllowAdditions to False means just that: no additions allowed.
It doesn't matter whether you've transiently displayed the new record
or not.

Set the AllowAdditions property back to False in the Form's
AfterInsert event.

John W. Vinson[MVP]
 
you can set the form's "AllowEditions"
minor typo: AllowAdditions.

ooooh, yeah.

but an "AllowEditions" property might have some intriguing possibilities...
:-)

Thanks, John.

--
George Nicholson

Remove 'Junk' from return address.
 
ooooh, yeah.

but an "AllowEditions" property might have some intriguing possibilities...
:-)

Not to mention "AllowElisions" and "AllowEvasions"...

John W. Vinson[MVP]
 

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

Back
Top