Full Version: Carry Forward Within Subjects
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
Manuel80
Hi all,

I checked for this topic but didn't found specific help, so I would be glad if someone could help.

I am developing a database for the outpatient clinic, I have a main form for the patient and a subform for visits. I would like to carry forward the values of some controls from one visit to another (e.g., a condition or therapeutic intervention which is likely to persist through the next visit), so I am using the following code in the AfterUpdate field for each control:

Me.ControlName.DefaultValue = """" & Me.ControlName.Value & """"

The code works between visits within the same subject, but if I add a new patient, the value in the control is carried forward to that patient as well. Is there a way to limit the carry forward procedure within the same patient, so that it is reset when a new subject is entered?

I am attaching an example database.

Thank you and all the best,
Manuel
theDBguy
Hi Manuel,

Perhaps, instead of setting the Default Values, you could just Duplicate the record in form and subform.

Just my 2 cents... 2cents.gif
Peter46
You can only have one default value in total not one per patient.

I would have thought that in real life it is very unlikely for consecutive records to be for the same patient (but you will know better than 1), so I wouldn't expect it to be worthwhile setting the defaults like that.

But iff you want to remember values for a patient they need to be stored within the patient record and then recalled when you identify the patient on the next record.

Manuel80
Thank you theDBguy,

I will try that, if there is no way to make it work through the Default.
theDBguy
Hi Manuel,

yw.gif

Peter and I are happy to help. Let us know how it goes...
missinglinq
Using the 'Default hack,' as you've described, is only going to work if you're sitting down and entering multiple visits for a single patient. To come back a day, a week, a month later, etc, you're going to have to use a 'copy record' hack, as Shrek suggested, or, for each value you want to 'bring forward,' the DLookup function with a 'Where' clause that utilizes the DMax function to identify the last visit for a given patient. All things considered, I'd opt for the theDBGuy's suggestion of copying the last Record/Subform Record.

Linq ;0)>
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.