Hey guys,
I am new to coding in VBA and need a bit of help. I use the following code below in my main form to prefill a text box (Prior1Text which is also in the main form) for new records to save a bit of time for entry. What I would like to do is this exact same thing, but it would prefill a text box in my subform. My subform control is called Prior1form and the text box I am looking to fill is called Text720 which would fill from field P1S1Description. This field is within the table that is related to the subform. I have tried using the same basic code in the subform, and while it works when it is just the subform open as a normal form, when it is embedded in as a subform it no longer works. Thanks for any and all help.
Code:
Private Sub Form_BeforeInsert(Cancel As Integer)
With Me.RecordsetClone
If .RecordCount > 0 Then
.MoveLast
Me.Prior1Text = !P1Text
End If
End With
End Sub