score:0

the easiest way to do this is to set the control source of the activerecordnametextbox to an expression. experience tells me you probably tried this but had trouble referring to the subform. i always have to use areference when i refer to subforms. here is a reference that also gives some explanation: https://www.fmsinc.com/tpapers/primer/index.html

if and only if is a natural choice for the expression given you want to select between two values. so if you want to refer to the subform controls use something like:

=iif(isnull(forms!mainformname![subformname].controls("businessnametextbox")),forms!mainformname![subformname].controls("primarycontacttextbox"),forms!mainformname![subformname].controls("businessnametextbox"))

you could also refer to the subform recordsource fields directly. also when refering to a subform from the mainform you can use relative references to get:

=iif(isnull([subformname].[form]![businessname]),[subformname].[form]![primarycontact],[subformname].[form]![businessname])

note since you weren't explicit about the edge cases like what to do if you have both a businessname and a primarycontact i just picked displaying the businessname if available and nothing if both where blank.


Related Query

More Query from same tag