can After Update event capture any change in a subform?

Hi Guys

Can After update event captures any change in a subform?
i am trying to update a field which is called last update, so in any change in a form it will automatically update this field.
Now i have this field in all tables form and subforms, it works fine, i was wondering if instead of adding code in the subform(After update) to update the parent form [last update] field, i can just add in the parent form(if After update captures any change in the subform),
please advice

Dim strSQL As String
'Update Subform
strSQL = "UPDATE EvaluationDetails SET EvaluationDetails.LastUpdatedDateTime = Now(), EvaluationDetails.LastUpdateUserID = DLookup('[user_id]', 'qryUserSecurity', '[user_name] = LAS_GetUserName()')  WHERE (EvaluationDetails.EvaluationDetailsID = [Forms]![Switchboard]![subfrmWindow].[Form]![EvaluationDetails].[Form].[EvaluationDetailsID]);"
DoCmd.RunSQL strSQL
 
'Update Parent Form
strSQL = "UPDATE PatientMaster SET PatientMaster.LastUpdateDate = Format(Now(),'mm/dd/yyyy'), PAtientMaster.LastUpdateUser = DLookup('[user_id]', 'qryUserSecurity', '[user_name] = LAS_GetUserName()')  WHERE (PatientMaster.PatientID = [Forms]![Switchboard]![subfrmWindow].[Form]![EvaluationDetails].[Form].[PatientID]);"
DoCmd.RunSQL strSQL

Open in new window

titorober23Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jeffrey CoachmanMIS LiasonCommented:
If you want to update a "Last Updated" Field in the subform , for any changes in the subform you will have to use the Before Update event to do this (I know "BeforeUpdate" sounds funny, but it's true)

Sample to follow...

JeffCoachman


0
titorober23Author Commented:
I want to capture it in both the subform and the parent form, i tried Before Update and it gave probelms with other events, so far After Update is working fine,
0
Jeffrey CoachmanMIS LiasonCommented:
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Jeffrey CoachmanMIS LiasonCommented:
So you have 3 Last Update Fields?
1. Main Form (for Last edit dates on the Main form record only)
2. Main Form for Sub Form Changes
3. SubForm for subform Records.

So any change in the subforms uptates Fields 2 and 3?

Is this correct?

JeffCoachman
0
titorober23Author Commented:
i have a main Form with a [Main - last update] field
and thre subforms, each one with a last update field, because each subform is independent(different information, related to the main form) and can be updated independently.
So when user make changes in Subform1, [Sub1-LastUpdate]=Now() and {main-LastUpdate]=Now()
Same thing with subform2 and subform3,
my original question, is
is there any event that will capture changes in any subform, so i do not have to update the main form from the after update event in each subform
0
Jeffrey CoachmanMIS LiasonCommented:
<my original question, is
is there any event that will capture changes in any subform, so i do not have to update the main form from the after update event in each subform>
...Then the answer is No

You will have to update the field from the BeforeUpdate event of each subform

JeffCoachman

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
titorober23Author Commented:
thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.