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.
Source: stackoverflow.com
Related Query
- MS Access 2013 - How to Trigger an Event on an Automatically Updating Textbox
- MS Access 2013 event trigger in module, not class module
- ADODB doesn't exist in Access 2013 project, how do I add a reference to it
- Access 2013 VBA - Setting New Click Event for Controls
- Excel VBA: How to trigger an Event from code?
- How to return a description with the form_error event in MS Access
- How can I trigger an event when multiple items added at once to Outlook Folder?
- Access 2007: How can I get the onclick event of a Treeview checkbox?
- Access VBA - Trigger combobox change event
- How to automatically trigger the App Object initialization in Powerpoint?
- How to Select All Text in TextBox After textBox.Setfocus Using Access VBA
- How to fix a cell that is not automatically updating due to a macro
- Updating an Access Table with a CSV File Automatically
- How to get keyboard 'Enter' to trigger button press on Access form?
- How do I access some sort of OnLoad event in Word 2007 VBA?
- How to trigger a click in Access database form from Excel VBA code
- How to trigger BeforeUpdate event on a checkbox only?
- Access 2013 - Save Value from Textbox and display again when form is opened after close
- How to call an afterupdate event from another module/control event (MS ACCESS VBA)
- Need to Automatically Edit Access TextBox in SubForm after SetFocus
- How to trigger a specific web page event with a vba macro
- How to detect what control triggers BeforeUpdate event in Access 2007
- How to trigger right mouse click event handler in Word 2016?
- MS ACCESS VBA: Me.Dirty = False OnTimer Event Reverts Edited Textbox Data
- Why would Access 2010 not trigger the form unload event when browseto is invoked from subform, instead of parent form?
- How to set a textbox to enabled on event
- MS Access 2003 - Message Box: How can I answer "ok" automatically through code
- How to cycle through Textbox Controls Access VBA
- How to Trigger MS Access Code based on specific time of day rather than every second or minutes
- How to create Access textbox that I can just type into?
More Query from same tag
- Impossible to connect to PostgreSQL DB via VBA
- Copy data from closed workbook and paste if they data in common
- Returning values from array separately
- Try to get some data from a web site
- Add column named current date
- VBA for data validation
- Variable Range VBA Using Months
- Would like to split columns with a variable and not have to use cases
- runtime error 2455 for textbox.selStart property
- Setting a Worksheet using both the worksheet name as defined in the object explorer with the workbook definition
- VbScript throwing an error "Unknown runtime error"
- one sheet from each workbook need to be saved as CSV
- Copy data from one sheet and move to other problems
- AfterUpdate in Access 2010 to populate textbox not working
- How to loop a particular code for each populated cell in a column
- Copy selected cells from one workbook and copy to another
- Found ID in textbox 1 to find row not applying checkbox choice to that row
- VBA: Extracting Text from child Div Class within Div Class
- Return the characters after Nth character in a string
- Putting dictionaries into classes
- Get unitVector X Y Z values
- VBA: Copy & Paste, Then Search, Copy & Paste
- How to add all message boxes into on final message box in VBA?
- Macro for taking the middle value of a string from a closed workbook doesn't work
- I m getting the error message " Object variable or With block variable not set"
- VBA: Unique items in a column across several worksheets
- Excel VBA Recipient Add based relevant cell
- Update Excel formula on another person's workbook
- VBA: preceding zeros dropped when copied over
- Save all emails and .msg files in outlook