Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Constraint problem in Access 97


Message #1 by "Ryback" <vbnovice2001@y...> on Sat, 7 Apr 2001 05:14:20
I've been trying to add a constraint to an Access table which restricts 

the user from entering a number in a field more than once within the same 

year. The tables consists of the following fields:





costing

-------



cnumber      - Number(data type)

costingdate  -  Date/Time



The statements below are not working:



1. alter table costing add constraint numberyear           unique

(cnumber,datepart('yyyy',costingdate));

2.alter table costing add constraint numberyear  

  unique(cnumber,year(costingdate));



Is there any way to enforce such a constraint?



~Ryback

  Return to Index