Parent - Child BO and Trying to Update Child


Author
Message
Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Terry,



Basically you are not using the correct object loRodeo as the values. In the For loop you are creating an instance loRodeo for each record in the Me.EventEntriesRodeoBO1 and that is what you have to use, so change your code as follow:





If EventEntriesRodeoBO1.MoveFirst Then

For Each loRodeo As EventEntriesRodeoBO In Me.EventEntriesRodeoBO1.GetEnumerable



Select Case loRodeo.eventCD

Case "BB"

ContestantsRodeoBO1.EventBB = loRodeo.eventCD

Case "BR"

ContestantsRodeoBO1.EventBR = loRodeo.eventCD

End Select



Next

End If

ContestantsRodeoBO1.Save()ContestantsRodeoBO1.Save()



Edhy Rijo

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Have you tried moving the Save() method inside the Select/Case statement? I might try something like this:



Select Case EventEntriesRodeoBO1.eventCD

Case "BB"

ContestantsRodeoBO1.Edit()

ContestantsRodeoBO1.EventBB = EventEntriesRodeoBO1.eventCD

ContestantsRodeoBO1.Save()

Case "BR"

etc.



Couple of questions:

Is there a reason that you are checking to see if the Parent BO has moved to the first BO?

Is there only one child BO per parent? If all of the children (assuming one to many) need to be updated, then you may need to iterate them also.



Not sure if this would work...and, I am losing my VB skills. Sorry.
Terry Bottorff
Terry Bottorff
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 448, Visits: 12K


If EventEntriesRodeoBO1.MoveFirst Then

For Each loRodeo As EventEntriesRodeoBO In Me.EventEntriesRodeoBO1.GetEnumerable



Select Case EventEntriesRodeoBO1.eventCD

Case "BB"

ContestantsRodeoBO1.EventBB = EventEntriesRodeoBO1.eventCD

Case "BR"

ContestantsRodeoBO1.EventBR = EventEntriesRodeoBO1.eventCD

End Select



Next

End If

ContestantsRodeoBO1.Save()ContestantsRodeoBO1.Save()





I am trying to iterate thru the parent(evententriesrodeobo1) and update a column in the child(contestantrodeobo1). This code is called from the click of a button on a form. Please note the attached screenshots. The parent child relationship works on the form so what am I missing in the code? I have traced the code and it seems to be doing what I need it to do except the data does not end up in the child in the database?????

I must be brain dead since this seems to be trivial BUT.?????? TIA
Attachments
ScreenShot003.gif (133 views, 21.00 KB)
ScreenShot004.gif (140 views, 14.00 KB)
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search