Synchronize an Editable Access Text Box with a Read-Only Subform
Question details
Keep a main-form text box editable while displaying related records in a read-only datasheet subform.
- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- A main-form text box displays the CustomerID from the current record in a datasheet subform.
- Observed behavior
- The text box uses an expression referencing the subform, but the user wants to edit the value without making the subform editable.
Open both forms in Design View and check their Record Source and Allow Edits properties. Determine whether CustomerID is a primary or foreign key and whether it needs to be changed, since relationships may restrict key edits.
Use a list box to navigate an editable customer form
Use a list box to select customers while editing fields on a separately bound main form.
A text box whose Control Source is an expression referencing a subform is calculated, not an editable field. Bind the main form to an updatable customer record source instead.
The example below assumes CustomerID is numeric and identifies a customer record. Prefer editing non-key customer fields unless changing the key is intentional and permitted by the relationships.
Open the main form in Design View, open its Property Sheet, and set Record Source to the customer table or an updatable customer query. Set Allow Edits to Yes.
Select the text box and set its Control Source to the field you need to edit. If it must be CustomerID, select CustomerID rather than an expression referencing the subform.
Add a list box named lstCustomers. Set its Row Source to a query containing CustomerID and a customer name, and set its Bound Column to the CustomerID column.
On the list box Property Sheet, set After Update to [Event Procedure] and open the code builder. Add these lines inside the procedure: Dim rs As DAO.Recordset If IsNull(Me!lstCustomers) Then Exit Sub Set rs = Me.RecordsetClone rs.FindFirst "[CustomerID] = " & CLng(Me!lstCustomers) If Not rs.NoMatch Then Me.Bookmark = rs.Bookmark rs.Close Set rs = Nothing
Open the subform in Design View and set Allow Edits to No. If it displays records related to the selected customer, check the subform control's Link Master Fields and Link Child Fields properties so they use the appropriate matching fields.
Switch to Form View, select a customer in lstCustomers, and confirm the main form moves to that record. Test an allowed edit in the main form and verify the subform remains read-only.
Evaluate an Access Split Form for record navigation
Use a Split Form when a single record source can support both the detail form and datasheet views.
Manage Customer Lists in WPS Office
WPS Office is a free, lightweight alternative for working with customer lists and documents in a familiar interface. Open compatible Office files to move everyday spreadsheet and document work into WPS. It does not fix or replace Access forms and databases.

Frequently Asked Questions
Why can't I edit a text box that displays the subform's CustomerID?
A text box with an expression as its Control Source displays a calculated value. To edit a field, bind the text box directly to that field on an updatable form record source.
How do I make the datasheet subform read-only?
Open the subform in Design View, select the form in the Property Sheet, and set Allow Edits to No. Review Allow Additions and Allow Deletions too if new or deleted records must also be prevented.
Will selecting a customer in a list box update the subform?
The list box can move the main form to the selected customer through its After Update event. A related subform can then follow the main record when its Link Master Fields and Link Child Fields are configured correctly.
Can I always edit CustomerID on the main form?
No. The form's Record Source must be updatable, and key or relationship constraints may prevent the change. Check the table relationships and decide whether editing a non-key field is more appropriate.




