Do I understand correctly that you have an unbound form on which
only the required fields are present?
Correct. No record can be created until all the controls are
appropriately populated.
But you do have to check whether the unbound fields have been
filled, right? You do that in code?
Yes. I generally write a function that checks the field values that
returns a Boolean, and then call that in a function that sets the
CREATE NEW RECORD button's .Enabled property to the value returned
by the first function. Then I place the second function as the
AfterUpdate of all the controls. Like this:
Private Function CheckFields() As Boolean
CheckFields = Not IsNull(Me!txtField1) _
And Not IsNull(Me!txtField2)
End Function
Private Function SetSaveButton() As Boolean
Me!cmbSave.Enabled = CheckFields()
SetSaveButton = Me!cmbSave.Enabled
End Function
I then place "=SetSaveButtons()" in the AfterUpdate property of all
the controls.
The CheckFields() function can be as complex as necessary, e.g.,
checking that different fields have logical values (e.g., Birthdate
is not greater than GraduationDate). Some of that checking should be
in the BeforeUpdate events of the individual controls, but some of
it could be in the CheckFields() function, as well.
In what way do you make clear to the user that the fields in the
form are all required?
They can't save it until it's properly filled out.
I can also imagine that in your main form you give the required
fields a specific color, so that users know those are required
fields which would prevent them from entering any value before
they know all values for the required fields.
Generally I don't. Indeed, I don't use a lot of required fields,
actually. I've found that what I think is required data from a
schema point of view turns out in the real world to simply not be
available. Rather than populate a bunch of fields with default
values, I simply compromise and limit the number of required fields
to the bare minimum. Indeed, I'll often have a minimum set of fields
required to create a record, and then allow the deletion of data in
those particular fields after the record is created.
It's probably sloppy of me to do so, but I'm trying to gently nudge
the users into creating good data on the front end, but then
allowing them freedom to do with it what they need to do after the
fact.