Search code examples
formsms-accesssubform

Autofill a subform field from a main form field


I have a form with two subforms, both of which are continuous. Each form has a field to accept the name of the person who created the record. Almost every time, the same person will be creating all of the records, so it would be really convenient if the fields would autofill once the main record has been set.

I've tried several approaches to this, but none seem to work quite right (e.g., the first of the continuous forms won't autofill because it came into existence alongside the main record). This is Access 2003.


Solution

  • OnCurrent, OnClick, etc...

    If IsNull(Me.MyField) or Me.MyField = "" Then
    
      Me.MyField = Me.Parent.MyRelatedField
    
    End If