This article was previously published under Q227211
Advanced: Requires expert coding, interoperability, and multiuser skills.
This article applies only to a Microsoft Access database (.mdb).
When you upsize a table containing a field with the
property set to
, the Microsoft Access 2000 Upsizing Wizard does not create a trigger or CHECK constraint in an attempt to enforce the rule.
After the Upsizing Wizard finishes, manually create a CHECK constraint or trigger to enforce the rule.
To Create a CHECK Constraint Complete the steps in the Steps to Reproduce Behavior section of this article to upsize the Employees table. Open the Access project that you created by following the instructions in the Steps to Reproduce Behavior section of this article. Open the Employees table in Design view. Right-click inside the Table Designer and click Properties. On the Tables tab, click New. In the Constraint expression box, type the following:
([LastName] <> '')
NOTE: There are no spaces between the apostrophes ('') in the sample above.
Close the Properties dialog box, and then Save the table. Open the Employees table in Datasheet view. Change Nancy Davolio's last name to "". Move off the record. Note that you receive an error message. Steps to Reproduce Behavior Open the sample database Northwind.mdb. Open the Employees table in Design view, and examine the properties of the LastName field. Note that the AllowZeroLength property is set to No. Close the Employees table. On the Tools menu, point to Database Utilities, and then click Upsizing Wizard. On the first screen of the wizard, click Create new database, then click Next. Specify a Server Name, Login ID, Password, and Database Name in the boxes provided. Click Next. In the Available Tables list, click Employees, move it to the Export to SQL Server list, and then click Next. Accept the default options and click Next. Select the Create a new Access client/server application option. In the ADP File Name box, type C:\AccessCS.adp, and then click Finish. NOTE: You will encounter multiple errors during the upsizing process. This is expected. Click OK each time that you are prompted. When the upsizing process is finished, close the Upsizing Wizard Report. The Access project, AccessCS.adp, created by the wizard should start. In the newly created Access project, right-click the Employees table and click Triggers. Examine both the Employees_ITrig and Employees_UTrig triggers, and note that neither contains SQL prevent zero length strings from being used in the LastName column. Open Employees in Design view, right-click inside the Table Designer, and click Properties. On the Tables tab, note that no CHECK constraints have been created to prevent a zero length string from being used in the LastName column.
For more information about constraints, see the SQL Server "SQL Server Architecture," in SQL Server Books Online. To download the SQL Server Books Online, please visit the following Microsoft Web site:
Article ID: 227211 - Last Review: January 26, 2005 - Revision: 2.2
APPLIES TO Microsoft Access 2000 Standard Edition
kbdownload kbbug kbfix KB227211
Contact us for more help
Connect with Answer Desk for expert help.