Is there a CONSTRAINT CHECK in Access SQL?

Posted on 2008-11-17
Last Modified: 2013-11-29
Seems like it should work but I've tried it and it won't!
Question by:bibeta
    LVL 3

    Accepted Solution

    In the Database window, click Database Diagrams  under Objects, click the database diagram you want to open, and then click Design on the Database window toolbar.
    In your database diagram, right-click the table that will contain the constraint, then select Constraints from the shortcut menu.
    Choose New. The Selected constraint box displays the system-assigned name of the new constraint. System-assigned names begin with "CK_" followed by the table name.
    In the Constraint expression box, type the SQL expressions for the check constraint. For example, to limit the entries in the state column of the authors table to New York, type: state = 'NY'

    Note   Make sure to enclose any non-numeric constraint values in single quotation marks (').

    If you want to give the constraint a different name, type the name in the Constraint name box.
    Use the check boxes to control when the constraint is enforced:
    To test the constraint on existing data before creating the constraint, check Check existing data on creation.
    To enforce the constraint whenever a replication operation occurs on this table, check Enforce constraint for replication.
    To enforce the constraint whenever a row of this table is inserted or updated, check Enforce constraint for INSERTs and UPDATEs.

    Author Comment

    The answer is not for Access 2007.

    Author Closing Comment

    It wasn't for access 2007

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    This isn't a frequent question on EE. I must have seen it three or four times (among several thousand questions). However, I use this trick quite often, most frequently as a delayed Current event. A form does not expose it's calculation dependenc…
    Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
    What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
    In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now