Hi. I'm currently frustrating myself to death trying to figure out why this isn't working. I want to create a table using SQL (or VB if necessary) that has validation code, and I've been told I should use check constraints to do that. However, I can't seem to get check constraints to work at all. I'm using Access 2003. Here is an example of what I am trying:
No matter what I do, it always gets caught on the CHECK. I've gone online and seen examples, and they all tend to look like this or have constraints added after the variables and separated by commas. That also won't work for me (it thinks "CHECK" is a variable name). I can't figure out what it is that I'm doing wrong. Any help would be greatly appreciated!
Code:
CREATE TABLE test (
id COUNTER CONSTRAINT PrimaryKey PRIMARY KEY,
enterer text(50),
datent datetime,
gender integer,
age integer CHECK (age<90));
No matter what I do, it always gets caught on the CHECK. I've gone online and seen examples, and they all tend to look like this or have constraints added after the variables and separated by commas. That also won't work for me (it thinks "CHECK" is a variable name). I can't figure out what it is that I'm doing wrong. Any help would be greatly appreciated!