Display message when add field fails

P

Paul Washburn

Ive have a button on my form that adds a new field using the default add
field button > field options > add field. I modified the table so that the
title field on the form will not accept blank values. Now when i hit the
button if the title is blank the form does nothing. Could someone help me
with the marco language to display a prompt informing the user that the add
failed because the title field is blank?

Thank you in advance.
 
J

Jeff Boyce

Paul

Just to make sure we're using the same terms the same way ...

It sounds like you are describing adding the ability into a user form to
allow them to add a new field to a table definition.

If this is what you are doing, how are you ensuring that the user knows
enough to add the new field to the proper table, and to maintain referential
integrity.

If Access were just a spreadsheet, adding a field would be largely
irrelevant. But Access is a relational database...

More info, please...

Regards

Jeff Boyce
Microsoft Access MVP
 
P

Paul Washburn

Think were on different pages. The form allows the user to add a record to
an existing table and save that entry. Setting the field property to not
allow null prevents the record from being added to the table with missing
data. The issue that im having is that it does so silently without informing
the user that it has failed and why it failed. Pressing the button produces
no visible results when the required field is blank.

Thanks for the help.
 
J

Jeff Boyce

Ah, adding a record, vs adding a (new) field, got it!

Allen Browne's web site has good information about silent fails on new
records.

The gist of it is that you may want to explicitly force a save, rather than
let Access silently fail.

If you don't want the user to be able to try to add (incorrectly), consider
using the form's BeforeUpdate event to run your validation checks. If a
required field has a Null, you can cancel the <save> and prompt the user.

?Any chance you can infer a default value for that field?

Good luck!

Regards

Jeff Boyce
Microsoft Access 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

Top