0. This rule checks if the gender field value contains the string "male" or "female" and is valid if it does, otherwise it is invalid."/> 0. This rule checks if the gender field value contains the string "male" or "female" and is valid if it does, otherwise it is invalid.">
To set gender validation rules in Access, you need to perform the following steps: Create or open a table and select the gender field to which you want to apply the rule. In the "Validation Rules" field in the "Field Properties" panel, enter the formula: InStr("Male;Female",[Field Name])>0. This rule checks if the gender field value contains the string "male" or "female" and is valid if it does, otherwise it is invalid.
Gender verification rule setting guide in Access
How to set gender verification rules?
Set up gender validation rules in Access in just a few steps:
Step 1: Create a new table or open the table you want to modify.
Step 2: Select the fields to which you want to apply validation rules. (Usually a gender field)
Step 3: Under the Field Properties panel, find the Validation Rules section.
Step 4: Enter the following formula in the "Validation Rules" field:
<code>InStr("男;女",[字段名称])>0</code>
Please replace "[field name]" with the field's as needed actual name.
Step 5: Click "OK" to save changes.
Rule explanation:
This validation rule uses the InStr()
function to check whether the value in the gender field contains "male" or "female" string. If included, the value is valid; if not present, it is invalid and Access displays an error message.
Note:
<code>Not IsNull([字段名称]) And InStr("男;女",[字段名称])>0</code>
The above is the detailed content of How to set gender of verification rules in access. For more information, please follow other related articles on the PHP Chinese website!