Hi,
This question pertains to Access 2010, though I'm familiar with 2007 as well. I'm trying to set up validation rules in one of my forms so that the combination of two fields is not duplicated. More specifically, I want to avoid the following scenario:
Student Program Subject EntryDate ExitDate
Student1 LifeSkills Math 7/1/2010
Student1 LifeSkills Math 8/7/2010 10/17/10
Student1 LifeSkills Math 9/1/2010
Stuff like this has actually happened in a previous version of the database, so I want to make sure I iron out some of the kinks and loopholes in Version 2.0. Ideally, I would like to test that if a Program and subject are the same, then an exit date is mandatory, and that the entry date for the new record is after the exit date.
Ideally, the second and third overlapping records would not be allowed to be added, forcing the user to keep the data "clean" i.e.:
Student Program Subject EntryDate ExitDate
Student1 LifeSkills Math 7/1/2010 10/17/2010
Does anyone have any suggestion how I'd go about this? This form is based on two tables, a tblProgram and a tblStudentProgram (a junction table between my tblStudent and tblProgram). I've tried using the DCount function and putting in the BeforeUpdate even on the form, but if pretty much flags everything as a duplicate, even when the program and subject fields have different values.
If anyone can point me in the right direction, I'd really appreciate it. As always thanks for your time!
This question pertains to Access 2010, though I'm familiar with 2007 as well. I'm trying to set up validation rules in one of my forms so that the combination of two fields is not duplicated. More specifically, I want to avoid the following scenario:
Student Program Subject EntryDate ExitDate
Student1 LifeSkills Math 7/1/2010
Student1 LifeSkills Math 8/7/2010 10/17/10
Student1 LifeSkills Math 9/1/2010
Stuff like this has actually happened in a previous version of the database, so I want to make sure I iron out some of the kinks and loopholes in Version 2.0. Ideally, I would like to test that if a Program and subject are the same, then an exit date is mandatory, and that the entry date for the new record is after the exit date.
Ideally, the second and third overlapping records would not be allowed to be added, forcing the user to keep the data "clean" i.e.:
Student Program Subject EntryDate ExitDate
Student1 LifeSkills Math 7/1/2010 10/17/2010
Does anyone have any suggestion how I'd go about this? This form is based on two tables, a tblProgram and a tblStudentProgram (a junction table between my tblStudent and tblProgram). I've tried using the DCount function and putting in the BeforeUpdate even on the form, but if pretty much flags everything as a duplicate, even when the program and subject fields have different values.
If anyone can point me in the right direction, I'd really appreciate it. As always thanks for your time!