AnsweredAssumed Answered

Auto-Enter Id from related table based on matching field text

Question asked by Xantrias on Oct 7, 2013
Latest reply on Nov 18, 2013 by Xantrias

Title

Auto-Enter Id from related table based on matching field text

Post

     Hi guys

     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:

         
  1.           Go to first record in table "Labels"
  2.      
  3.           Loop
  4.      
  5.           Check if DocumentId=Labels_DocumentId
  6.      
  7.           If true, auto enter the Id from the table "Documents" into "DocumentsIdFk"
  8.      
  9.           Go to next record in table Documents, exit after last.
  10.      
  11.           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!

     Greetings Xantrias

Outcomes