Auto-Enter Id from related table based on matching field text
I've tried to find a solution via the search option, but I couldn't find any help. Maybe I entered the wrong search string...
So I have two related tables as follows:
- Documents: Id (auto serial number), DocumentId, DocumentName
- Labels: Id (auto serial number), DocumentsIdFk, Labels_DocumentId, Labels_DocumentName
All Labels_Documents are also in the table Documents. So there has to be a match between those.
I wanted to write a script for the table "Labels" that should do the following:
- Go to first record in table "Labels"
- Check if DocumentId=Labels_DocumentId
- If true, auto enter the Id from the table "Documents" into "DocumentsIdFk"
- Go to next record in table Documents, exit after last.
- End Loop
Something like that. How do I get the script to get the current Id value from the matching field on the table "Documents"?
Thanks in advance for any help I can get!