Justin,
I am surprised you are having trouble with Bharats code. Iam using the code described and it works perfectly every time. The only problem I find is using it with table subforms but that is a Known bug with the subform.
Maybe we missed something in implementing it into your application.
This code:
Take the PatientID automatically from the mainform to subform and assign it PatientID in Subform.
(change patientid to your element name.)
First In the mainform, in patientid on Form entry event, please put the following code
if @update then
{
Globalvalue ("PatientID", patientID)
writeln (@globalvalue ("patientID") + " is new Globalvalue")
}
next In the mainform, in patientID on Element Exit event, please put the following code
if @Isnew then
{
Globalvalue ("patientID", PatientID)
writeln (@globalvalue ("PatientID") + " is new Globalvalue")
}
You may remove writeln line after you are confident that the code is working.
=========
This part returns the patientid to the subform record
Now in the database that the subform is created from. Using on form entry put the following code in patientid element
patientID = @globalvalue ("patientID")
Hope this helps a little, Keep us posted. Eventually we will all figure it out. Hang in there