kcn
Programmer
- Jul 5, 2002
- 27
Hi All,
I'm not sure how to word this, so bear with me!
I have a data entry form, Form A, which has the recordsource, Table A. The user enters data in Form A and then clicks on a button to open Form B. When this happens two values are coppied over to Table B (recordsource of Form B): an ID, and a Year. There's a one to many relationship between Table A and Table B.
I need to prevent the user from entering more than one record in Table B that has the same Year value for the relating ID.
ID YEAR
1 100 2000 OK
2 101 2000 OK
3 102 2001 OK
4 102 2001 Not OK!
I'm assuming I need some kind of code that loops through Table B and checks both fields, and then gives an error message to the user, but I don't know how to write this. Any help would be very appreciated!
thanks!
K
I'm not sure how to word this, so bear with me!
I have a data entry form, Form A, which has the recordsource, Table A. The user enters data in Form A and then clicks on a button to open Form B. When this happens two values are coppied over to Table B (recordsource of Form B): an ID, and a Year. There's a one to many relationship between Table A and Table B.
I need to prevent the user from entering more than one record in Table B that has the same Year value for the relating ID.
ID YEAR
1 100 2000 OK
2 101 2000 OK
3 102 2001 OK
4 102 2001 Not OK!
I'm assuming I need some kind of code that loops through Table B and checks both fields, and then gives an error message to the user, but I don't know how to write this. Any help would be very appreciated!
thanks!
K