General discussion


Force user to enter data in access form

By dliby1 ·
I have a Access2000 form. The user needs to be forced to enter data in field named comments (text field). I only want this particular form to force the data entry.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by nla467 In reply to Force user to enter data ...

You need to go to the table design view of your database and click the field that you want to require your user that data needs to be entered, in the lower portion, click the required property box and select Yes. This should take in effect with your form as long as the form is connected with the db, which I think you have.

Hope this helps...:0)

Collapse -

by Pr0x1 In reply to Force user to enter data ...

In addition to going to the table and requiring an entry (which means it cannot be null), you can also check the form prior to submission and even trap the Null value and display a message box stating that the user needs to enter a value:

If IsNull Me![<field&gt Then
MsgBox <message attributes>
End if

You should still change the table-field attributes, but you can avoid unfriendly user error messages by trapping in code in an event procedure (on click, on update, etc.)


Collapse -

by ADCA In reply to Force user to enter data ...

Since you want this ONLY on this particular form, you do not want to set the required entry properties at the table level, use the form level instead. On the Data tab for the control (textbox) for that field, set the following properties:

Validation Rule:

Validation Text (your user message):
"You must enter a non-null value in this field"
or something else that communicates well with your user.


Collapse -

by ADCA In reply to

Answer #2's suggestion about trapping in code is also a good approach and, imho, more flexible than my suggestion--mine is probably the quickest, but trapping in code and diplaying a dialog (msgbox) would allow you to gather some input from the user if desired and take other action(s) programatically. A good event to attach code like this to would probably be the Form before update or the before update of the control.

Related Discussions

Related Forums