Enhancing Database table design in MS Access Conclusion
This module discussed various ways of making sure that the data that gets entered into your database comes in a bit cleaner by using
field properties such as the Validation Rule property and lookup fields. You also saw how to:
- Use the Validation Rule property to test data
- Set the Validation Text property to display a custom message
- Use the Input Mask Wizard to specify data input formats
- Set up fields that display Combo Box and List Box controls for data input
- Use the correct data type for optimal performance
One area with major changes in the new version of Access is macros.
Not only did the macro interface get a facelift, but it was revamped and upgraded to include table-level triggers and a rich functionality previously available only through VBA coding. Access 2010 offers two types of macros:
- UI macros and
- Data macros.
We discuss them briefly here:
UI macros are what we used to call macros in previous versions of Access.
However, they not only have a new name, but they also feature a number of notable improvements.
The UI macro Editor, provides an interface that resembles a code editor complete with complex logic, error handling, and looping through records. In addition, it provides the added convenience of collapsible segments. The redesigned UI macros allow you to create a rich and productive UI for your users to interact with the data. UI macros can be used in combination with Data macros to report back validation rule status and errors that may have occurred.
Data macros can serve as a convenient vehicle to help implement business rules in your application.
Similar to using Triggers in SQL Server
, you can use Data macros to attach logic to record events (also referred to as table events), centralizing the logic in one place, the table, where forms that are bound to the table inherit that logic. Data macros also enable you to manage calculated fields,
ensuring that the current data stored is always the most accurate. The table events that can be used to set the macros are
- AfterUpdate, and
You can also set your macro as a Named macro and associate it with a table.
The Named [Data] Macro can be called from other Data macros or UI macros and from VBA code so it can easily be leveraged and reused through the application.
Field Level Properties Validation Purposes - Quiz