AnsweredAssumed Answered

Check If Record Already Exist Before Allowing to Add a Record Number

Question asked by DranLang on Sep 10, 2013
Latest reply on Sep 10, 2013 by DranLang

Title

Check If Record Already Exist Before Allowing to Add a Record Number

Post

     Good morning everyone!  I have a question regarding verifying if a record number already exist before it allows a user to add record.  It could be easy for me if I could use Serial Number but my boss specifically told me that it needs to be manually done. 

     Here's how he wants it to work.  When a number is entered it needs to verify first if that record number already exist and if it does, we need to tell the user to try again before it can proceed.  If the number entered hasn't been used yet, the layout where adding record will appear and the number that was entered will automatically be assigned to the field where it should be.

      

     I've written a script but for some reason sometimes it works and sometimes not, and I'm not sure if my script is correct since I'm relatively new to FileMaker script writing.  Below is the script I wrote, any input/ help to make this script work is highly appreciated.

      

     Copy[Select; Table1::ID_LookUp]

     If{IsEmpty(Table1::ID_LookUp)]

          Show Custom DIalog["MESSAGE";"MESSAGE AGAIN"]

          Go to Layout [original layout]

     Else If(Table1::ID_LookUp = Table2::ID#)

          Show Custom DIalog["MESSAGE";"MESSAGE AGAIN"]

          Go to Layout [original layout]

     Else

          Go to Layout ["Lay_RECORD" Table2)]

          Set Variable [$ID_Temp; Value:Table1::ID_LookUp]

          Go to Record/Request/Page [Last]

          New Record/Request

          Set Field ["Table2::ID#; $ID_Temp]

     End If

      

      

Outcomes