'Empty row cannot be inserted'

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

Guest

Hi

I have a form for data entry bound to a table with an autionumber field as
the PK.

The fornm is opened in Insert mode. When I close the form with the close
button the record is saved to the DB.

If I close the frm without making entering any data the form closes fine and
no data is written to the DB.

However if I entyer data and then delete it and exit the form I get the
error message 'Empty row cannot be inserted'

Any ideas how to (easily) get around this?

Allen
 
As you eneter a value in one of the fields a record is created but it not
saved yet until you close the form or move to the next record.
Deleting the value from the field doesn't remove the record that is just
created, you need to either press the ESC key twice to remove the changes
from the form

Another option will be, to use the form before update event to check the
value in some field, and if no data entered then undo the changes

If Isnull(me.[Field1]) And Isnull(me.[Field2]) And Isnull(me.[Field3]) Then
Me.Undo
End If
 
Thanks Ofer - works a treat.

Ofer Cohen said:
As you eneter a value in one of the fields a record is created but it not
saved yet until you close the form or move to the next record.
Deleting the value from the field doesn't remove the record that is just
created, you need to either press the ESC key twice to remove the changes
from the form

Another option will be, to use the form before update event to check the
value in some field, and if no data entered then undo the changes

If Isnull(me.[Field1]) And Isnull(me.[Field2]) And Isnull(me.[Field3]) Then
Me.Undo
End If

--
Good Luck
BS"D


Allen Davidson said:
Hi

I have a form for data entry bound to a table with an autionumber field as
the PK.

The fornm is opened in Insert mode. When I close the form with the close
button the record is saved to the DB.

If I close the frm without making entering any data the form closes fine and
no data is written to the DB.

However if I entyer data and then delete it and exit the form I get the
error message 'Empty row cannot be inserted'

Any ideas how to (easily) get around this?

Allen
 
Back
Top