Hi all,
I have a problem I hope I can get some help on. I want to be able to validate data when entered using a list of valid entries stored in a table, but can't seem to work out how.
The main tables in my (simplified) example database are:
Tissue Samples
Sample ID/River (and lots of other fields in the read db)
eg data
A01/Dee
A02/Don
A03/
A04/Esk
A05/Don
River List
ID/River
eg data
1/Dee
2/Don
3/Esk
4/Clyde
When I enter records into my Tissue Samples table I want to run a check on the river name using a list of valid entries from the River List table. It seems such a simple thing to want to do, but I just can't work out how.
Data is entered into the table using a form which is linked to a third table:
Tissue Samples new data
Sample ID/River
Users open this new data form/table and paste the data in (often hundreds of records). Then run a macro that will:
1) Append new records to the Tissue Samples table if the ID on these records is not already in this table (using an append query)
2) Update records which have their ID already in the Tissue Samples table with new data in their various fields (overwriting what is already in there if necessary, or just filling in missing data in empty fields) (using an update query)
3) Clear the new data table for further use later (using a delete query)
What I want to do is that when I run the append/update/clear macro the river names are checked and if the river name is not in the Rivers List a message appears telling the user that there are records that do not match this validation. I would then like the rest of the correct data to be added to the Tissue Samples table, and the problem records stored in a 'Paste Errors' table so the user can go through and make corrections.
Although I am a bit of a noob, I have been able to get simple validation rules working, but can't seem to work out how to validate against fields in a separate table. I thought it would be a common requirement, but lots of searching has led me no-where (although it did lead me to this very useful forum from which I have already learnt a lot!).
I have attached the example db, and I hope I have given enough info, and that some kind soul can help me.
Thanks in advance
I have a problem I hope I can get some help on. I want to be able to validate data when entered using a list of valid entries stored in a table, but can't seem to work out how.
The main tables in my (simplified) example database are:
Tissue Samples
Sample ID/River (and lots of other fields in the read db)
eg data
A01/Dee
A02/Don
A03/
A04/Esk
A05/Don
River List
ID/River
eg data
1/Dee
2/Don
3/Esk
4/Clyde
When I enter records into my Tissue Samples table I want to run a check on the river name using a list of valid entries from the River List table. It seems such a simple thing to want to do, but I just can't work out how.
Data is entered into the table using a form which is linked to a third table:
Tissue Samples new data
Sample ID/River
Users open this new data form/table and paste the data in (often hundreds of records). Then run a macro that will:
1) Append new records to the Tissue Samples table if the ID on these records is not already in this table (using an append query)
2) Update records which have their ID already in the Tissue Samples table with new data in their various fields (overwriting what is already in there if necessary, or just filling in missing data in empty fields) (using an update query)
3) Clear the new data table for further use later (using a delete query)
What I want to do is that when I run the append/update/clear macro the river names are checked and if the river name is not in the Rivers List a message appears telling the user that there are records that do not match this validation. I would then like the rest of the correct data to be added to the Tissue Samples table, and the problem records stored in a 'Paste Errors' table so the user can go through and make corrections.
Although I am a bit of a noob, I have been able to get simple validation rules working, but can't seem to work out how to validate against fields in a separate table. I thought it would be a common requirement, but lots of searching has led me no-where (although it did lead me to this very useful forum from which I have already learnt a lot!).
I have attached the example db, and I hope I have given enough info, and that some kind soul can help me.
Thanks in advance