1 Reply Latest reply on Mar 5, 2012 3:24 PM by philmodjunk

    Create related record with identical form?



      Create related record with identical form?


      I have two related tables, "Medication" and "Patient".  Each table is related with a "prescription_ID" key. They are related so that new records can be created in "Medication" table as one patient can have multiple meds.  I cannot figure out how to make a script that will reset the entry form and allow creation of new med records while keepiing the patient's name. When I script in the new record form, it erases everything, including the patient name.  I want to keep the patient name, but only erase the current med info for the new record.  





        • 1. Re: Create related record with identical form?

          You appear to have this relationship:

          Patient::Prescription_ID = Medication::Prescription_ID

          Since you can have many medication records for one Patient, this should be

          Patient::Patient_ID = Medication::Patient_ID

          so that you can have many records in Medication all with the same patient ID value to link them to the same patient record.

          I would then suggest that you set up a portal to Medication on your Patient layout. This way you can add as many medication records for a given patient simply by entering data in the portal fields. If "allow creation of records via this relationship is enabled for the Medication table in this portal's relationship, then the patientID value is automatically copied from the current Patient record to the new Medication record each time yo create a new record in the portal.

          You can also do this from a layout based on Medication, but it's a less simple approach and takes a bit more set up work to make it work for you.