I am resetting my issue in the Forms forum (from Modules) in hopes I can get unstuck.
In my db, I have a ProgramsT table (pk ProgID), a ProgrammersT table (pk ProgmrID) and a junction table, ProgramRoleT (pk ProgRoleID). I have a form that presents a query of ProgramsT, with a subform to present current Program/Programmer relationships,bound as follows:
Code:
SELECT ProgramRoleT.*, ProgrammersT.MemberID, MembersT.MasterID, ContactMasterT.LastName, ContactMasterT.FirstName, ContactMasterT.MiddleName
FROM ((ContactMasterT INNER JOIN MembersT ON ContactMasterT.MasterID = MembersT.MasterID) INNER JOIN ProgrammersT ON MembersT.MemberID = ProgrammersT.MemberID) INNER JOIN ProgramRoleT ON ProgrammersT.ProgmrID = ProgramRoleT.ProgmrID;
That part seems to work OK. However, I want to give the user the option of selecting a new Programmer for the Program, who must be selected from amongst Members. I am trying to do this through a second subform bound to ProgramRolesT. The subform is set to data entry. It contains a combo box that draws MemberID from the table MembersT, passes it to a control called MemberID and calls a new form to create the new ProgrammerT record. My current code to do this is:
Code:
Private Sub Combo13_AfterUpdate()
Me.MemberID = Me!Combo13.Column(0)
DoCmd.Hourglass True
DoCmd.OpenForm "ProgrammerNewF2"
DoCmd.Close acForm, "ProgrammerNewF2", acSave
DoCmd.Hourglass False
End Sub
This works perfectly to create the new ProgrammersT record, but I have two problems - capturing the ProgmrID fk from the new ProgrammersT record, and writing the new ProgramRoleT junction table record to link the two. Capturing the new ProgmrID value should, I think, be doable in code, although I've not succeeded yet (I think problems with null values??) but the failure to save the new junction record looks to me like an events issue to my uninitiated brain. The blank subform shows (New) in the junction record pk field, but it does not populate the new pk value as the record is (supposedly) populated (see screenshot).
Can anyone make any suggestions?