How to Refresh a DLookup Result from an Access Subform
Question details
The user needs an unbound DLookup text box on a main Access form to update after a related record is changed in a subform or separate data-entry form.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- A main Access form contains a text box that uses DLookup to display a calculated total from a query. The related record can be edited in a subform or through a separate data-entry form.
- Observed behavior
- The DLookup text box value remains stale and does not update after the related record is changed in the subform or separate data-entry form.
Make sure the main form text box name and the subform or data-entry form event properties are available in Design View, and confirm that the underlying record has been saved before the requery runs.
Requery the DLookup text box in the subform's After Update or On Exit event
Use this when the related record is edited directly in the subform and the main form total must refresh after the subform record is saved or exited.
The DLookup text box is unbound, so Access does not automatically requery it after a subform record changes. The event procedure explicitly refreshes that control.
Right-click the main form in the Navigation Pane and choose Design View. Select the DLookup text box, open the Property Sheet, and note the control Name shown on the Other tab.
Select the subform control on the main form, open its Property Sheet, and open the subform in Design View from the Navigation Pane or the subform object.
On the subform Property Sheet, click the Event tab. Select After Update or On Exit, click the build button (...), choose Code Builder, and enter Forms!MainFormName!TextControlName.Requery using the exact main form and control names.
Save the form, switch to Form View, edit a related record in the subform, and confirm the main form DLookup text box updates after you save or exit the row.

Requery the main form control from the separate data-entry form's Close event
Use this when the related record is changed through a separate input form and the main form still shows the old DLookup value after the input form closes.
Use WPS Office as a Free Alternative to Microsoft Access for Lightweight Data Tasks
WPS Office cannot directly fix Microsoft Access DLookup refresh behavior, but it provides a free, lightweight Office suite with a familiar ribbon interface and strong compatibility with common Microsoft Office formats. For many lookup and total tasks, WPS Spreadsheets can rebuild the calculation without requiring an Access database.

Frequently Asked Questions
Why does the DLookup text box not update automatically when the subform record changes?
A DLookup text box is unbound, so Access does not automatically reevaluate it after related records change. Add an event procedure such as Forms!MainFormName!TextControlName.Requery in the subform After Update or On Exit event.
Where should I put the requery code when the record is edited in a separate form?
Use the separate data-entry form's Close event after the save operation. Enter Forms!MainFormName!TextControlName.Requery so the main form control refreshes when the input form closes.
Do I need to requery the subform or the text box?
For a DLookup text box on the main form, requery the text box control itself. If the subform records are also stale, additionally requery the subform Form object with Forms!MainFormName!SubformControlName.Form.Requery.
Can I refresh the DLookup result with a macro instead of VBA?
Yes. In the subform After Update or On Exit event, use the Requery control action and target the main form text box control. For a separate form, use the Close event with the same Requery control action.
Why does the refresh only work when I move to the next record?
The event timing matters. After Update runs after the record is saved, and On Exit runs when you leave the subform control. If you move to the next record, one of these events fires and the requery updates the main form text box.




