Mandatory fields on forms (1 Viewer)

kobiashi

Registered User.
Local time
Today, 22:13
Joined
May 11, 2018
Messages
258
is there an easy way to make all fields mandatory on a form, or will i have to add vba to each field on "BeforeUpdate"?
 
set field property ALLOW ZERO LENGHT = FALSE
you can also set VALIDATION RULE =NOT NULL
and set the VALIDATE TEXT = "required"
 
Ranman256's suggestion works. You don't need VBA on each field, though. You can put code in the BeforeUpdate event to test all mandatory fields and use the Cancel option to disallow the update if some fields are not acceptable.

What I did when I had a mandatory field was I highlighted the field's .Bordercolor in yellow and also highlighted the field's label .Backcolor in yellow. Since my form's .Backcolor was a pale green, that made the required fields stand out quite well. And the other side of that is that in the form's Current event, you can reset the borders and backgrounds to fade into the form, either by making them transparent or by making them match the form.

So you would use VBA in two places. One place to highlight stuff, one place to turn off the highlights.
 
set field property ALLOW ZERO LENGHT = FALSE
you can also set VALIDATION RULE =NOT NULL
and set the VALIDATE TEXT = "required"

is this carried out in the table properties or the form properties?
 
The suggestions from Ranman256 are field validation properties in the table definition. You see these at the bottom of the panel if you highlight a field.
 

Users who are viewing this thread

Back
Top Bottom