Avatar of pdvsa
pdvsa
Flag for United States of America asked on

Parent and subform- On Current update record

Experts, I have a parent (frmParent) and subform (sub1) and they are linked by ID's as found in the properties.  
I enter details in the parent such as currency (its a cbo) and DrawDate.  After I enter the details on the parent, I go to the sub and want the same values to be inserted (for a new record but also to update for not a new record).  it seems like I am having a refresh issue because the "new record" line in the subform seems to no longer appear after I click on it but the values seem to update tho but I just cant add more records.  If I hit the F5 button, I will see the "new record" line appear again and I can add just a single record but will need to hit F5 once again to add another record.  

I do have If me.dirty = false in the On Dirty event of the subform but that doesnt refresh like the F5 button.

Sub1:
Private Sub Form_Current()
            Me.Currency = Me.Parent.Currency
            Me.ValueDate = Me.Parent.DrawDate
            Me.Refresh 'this doesnt seem to refresh like F5
    End If
End Sub


Not sure if is is clear.  Let me know if you need additional clarification.
Grateful for your help.

here is a screen print:
Parent_sub
Microsoft Access

Avatar of undefined
Last Comment
PatHartman

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
PatHartman

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
pdvsa

ASKER
thank you.  
I put that code on BeforeInsert and it seems to work fine now.   Havent tested completely though but I think its the solution.  

thank you for the help and great explanation
PatHartman

You're welcome.  I would have preferred that you not duplicated the data since that violates second normal form but getting the code into the correct event is a start.
pdvsa

ASKER
Ahhh i did not  think about that.  Sometimes i think that when the data is properly normalized one has to be an expert to develop the queries to extract.  Thank you again for that tip
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
PatHartman

You also have to consider what happens if you change the value in the parent record.  Is it OK for the parent record to have a different currency or draw date?  If it isn't, you see the real issue because you now have created a data anomaly.  That is why the data should not be stored in multiple places.