I have MsAccess Form:
ClientName, ID fields - records filled with the information
Gender, Race, PrimaryLanguage fields (combo box type) are empty records
Users will fill Gender, Race and PrimaryLanguage, PrimaryDisability fields with the information. My goal is - before user will move to the next record, I want he to be unable to proceed until those fields (Gender / Race) are filled with its content.
The problem is - Gender / Race / PrimaryLanguage, PrimaryDisability for the existing clients have to stay empty, but at the same time - when user starts filling it, it needs to be filled mandatory.
It works this way only in case if I am adding a new record. (I have Gender / Race fields as required) - but doesn't work with the existing records.
PS - the answer provided below is great, but worked on my end for 2 fields only What about 3 or more fields?
I had idea of adding the event procedure to each button in the Form, not to the whole Form. code should be something like:
Private Sub Gender_BeforeUpdate(Cancel As Integer)
If Nz(Me.Gender, "") = "" And (Nz(Me.Race, "") <> ""
Or (Nz(Me. PrimaryLanguage, "") <> ""
Or (Nz(Me. PrimaryDisability, "") <> "")
Then
MsgBox "Select Gender", vbInformation
Cancel = True
End If
End Sub
But it says about syntax mistakes
Please help!