Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Is there a CONSTRAINT CHECK in Access SQL?

Posted on 2008-11-17
3
Medium Priority
?
1,455 Views
Last Modified: 2013-11-29
Seems like it should work but I've tried it and it won't!
0
Comment
Question by:bibeta
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
dro_law earned 1500 total points
ID: 22978746
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.
0
 

Author Comment

by:bibeta
ID: 22978954
The answer is not for Access 2007.
0
 

Author Closing Comment

by:bibeta
ID: 31517539
It wasn't for access 2007
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses

564 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