Table & form validation rules can be set at the table level or form level. Use the power of the database to manage your form validation. Why spending time coding something that the database can already handle for you?
Remember that a validation rule created at the table level is available to all the forms and reports in your database. The validation rule created at the form level is for that form only.
Watch the video:
Here is a handy Table & Form Validation Rule reference chart:
| Validation Rule | Tests For | Validation Text | |
|---|---|---|---|
| <>0 | Whether or not the value entered is different from 0 | “Please enter a non-zero value.” | |
| 0 or >100 | Whether the value entered is 0, or greater than 100. | “The value entereed must be either 0 or over 100” | |
| Like “K???” | Whether or not the value entered is 4 characters long, and begins with the letter K. | “The value of your entry must begin with the letter K and be 4 letters long.” | |
| < #2/12/2007# | Whether or not the date entered falls before 2/12/2007. | “The value of your entry must be before 2/12/2007.” | |
| Between 0 And 1 | Whether or not the value entered is between 0 and 1. | “Please enter a percentage amount from 0 to 100%” | |
Default values are another way of validating data entry. By having a default value, new records are automatically populated with required information.
Making a field entry “Required” is another method of making sure the user doesn’t skip entering a value in a field.
The video shows some fields with built in form validation. Fields like:
The check box
The combo box
The option group
The list box
Then various ActiveX Controls
These controls limit the user to the given selections. Any time you limit the selection to the user, you are enforcing validation.
Here is the code I used:
Option Compare Database
Private Sub btnSelect_Click()
Select Case Me.Frame0
Case 1
MsgBox "Red"
Case 2
MsgBox "Yellow"
End Select
End Sub
Private Sub Calendar1_Click()
MsgBox Me.Calendar1.Value
End Sub
Private Sub Form_Current()
Me.Calendar1.Value = Now()
End Sub

<< MS ACCESS FORM VALIDATION – PT1 | MS Access Validation – PT2 (explained)>>

How to Delete Blank Rows in Excel Using VBA (Step-by-Step Guide)
How to Delete Blank Rows in Excel Using VBA (Step-by-Step Guide) When you work with large datasets in Excel, it’s common to end up with thousands of blank rows scattered throughout your worksheet. Maybe your data came from a mainframe export, a CSV download, or a legacy system that doesn’t format properly. Deleting all those […]
How to Copy Data from One Worksheet to Another Using VBA in Excel
Learn how to copy data between worksheets in Excel using VBA step-by-step! This quick tutorial shows how to automate data movement, save time, and boost productivity. Watch: How to Copy Data from One Worksheet to Another Using VBA Why Automate Copying Data Between Worksheets? Copying and pasting data manually can take up valuable time and […]
Learn Access VBA: Understand Tables, Queries, Forms, and Reports
Learn Access VBA: From Zero to Database Hero If you’ve ever opened Microsoft Access and wondered how all the pieces fit together — tables, queries, forms, and reports — this tutorial is made for you. In just a few minutes, you’ll understand how Access works behind the scenes and see how VBA (Visual Basic for […]
How to Fix Run Time Error 1004 in Excel
If you work with Microsoft Excel frequently, chances ar ling for a solution. Fortunately, this error is well-documented, and there are several ways to resolve it. In this article, we’ll explore the causes of run time error 1004, practical steps to fix it, and preventive measures to reduce the chances of it happening again. What […]
Support these sponsors:

