Preventing blank records

  • Thread starter Thread starter Steve Kendrot
  • Start date Start date
S

Steve Kendrot

Hello all,

I have a form in my database that have unbound controls in
the header section that contain values (such as date,
observer etc...) to update fields that remain the same for
new records entered during a particular data entry
session. I have a control button in the form header that
runs a macro that updates null values in certain fields in
a new record to the values in the unbound control in the
form header. I have the forms data entry property set to
yes so that users can only see new records when the form
is opened. The form opens with the cursor in the first
record which has null values in every field, but has had
an autonumber assigned to it. The user then has to leave
that record and move the cursor to the header section to
fill in the default parameters. If they launch the new
record macro with the command button, a new record is
created and I am left with a blank record (the one created
when the form was opened)that I then must delete.

Is there any way to prevent this?

Steve
 
Steve,

There are several ways to do it. The most straight-forward one is to go back
to the table design and make these fields mandatory (Required > Yes). This
way Access itself will not allow records to be saved with nulls in those
fields, plus it will automatically produce the appropriate warning upon
attempt to save.

HTH,
Nikos
 
Back
Top