Subform "SubPT" is bound to table TBL_TRAINING_PR OTOCOL. The main form that contains it is unbound, and contains 3 unbound combo boxes: "ComboStudy ", "ComboNumbe r", and "ComboVersi on". Each of these sets the value of a locked text box in the subform, as you can see in the after_update code below. These text boxes are bound to the appropriate columns in TBL_TRAINING_PR OTOCOL.
SubPT is filtered per the following code:
Everything almost works out fine with the filtering: the correct records display, as does the starred new record row; but an additional, blank record also displays, and TBL_TRAINING_PR OTOCOL has a new row with the 3 columns filled in per the text boxes.
My question is this: how do I tweak this so that only the currently extant records fitting the filter display, while also allowing me to add a new record which will include the values from the textboxes?
Thanks!
SubPT is filtered per the following code:
Code:
Private Sub Form_Load() If IsNull(Me.ComboVersion) Then Me.SubPT.Form.Filter = "[PROTOCOL TRAINING ID] = 0" Me.SubPT.Form.FilterOn = True End If End Sub Private Sub ComboVersion_AfterUpdate() Forms!FRM_TRAINING_PROTOCOL!SubPT.Form!STUDY = Me.ComboStudy.Value Forms!FRM_TRAINING_PROTOCOL!SubPT.Form![PROTOCOL NUMBER] = Me.ComboNumber.Value Forms!FRM_TRAINING_PROTOCOL!SubPT.Form![PROTOCOL VERSION] = Me.ComboVersion.Value Me.SubPT.Form.Filter = "[PROTOCOL VERSION] = """ & Me.ComboVersion.Value & """" SubPT.Requery End Sub
My question is this: how do I tweak this so that only the currently extant records fitting the filter display, while also allowing me to add a new record which will include the values from the textboxes?
Thanks!
Comment