abruehl

Script to create a new record with related data

Discussion created by abruehl on Jul 18, 2017
Latest reply on Jul 19, 2017 by abruehl

Hi all,

 

I've done a bunch of research on this and think I'm doing it right, but it's not working! Can you please help me out?

 

I have a Patients table with ID, name, and other contact info. When I see a new patient, I always create an initial intake for them, so I'd like to be able to have a button on my Patients layout that automatically creates a record in my Initial Intake layout (which has its own table; I've set up a relationship between the patient IDs on both tables) with that patient's ID number and FullName.

 

So, two tables, Patients and Initial Intake. Patient ID is just ID and Initial Intake patient ID is PxIdFk.

 

In the Patients layout, I have a button set up with the following script:

Screen Shot 2017-07-18 at 1.25.14 PM.png

I've done various versions of Step 3 with Initial Intake:PxIdFk in the second brackets, but that didn't work either

 

It is making a new record in Initial Intake and keeping me in the Patients layout, but it's not filling in the patient's ID number (in Initial Intake).

 

Here's the relationship:

Screen Shot 2017-07-18 at 1.23.50 PM.png

 

Any and all help would be very much appreciated! I'm driving myself nuts

 

Thanks!

Outcomes