Display 0 in an Access Text Box When a Continuous Form Has No Records
Question details
The user needs an Access continuous-form text box to display 0 when there are no records and remain updated after a search dialog requeries the form.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- A search dialog changes the criteria and requeries an already-open continuous form.
- Observed behavior
- The text box becomes blank when the form has no records or after the search dialog requeries it.
Open the continuous form in Design View and check the text box's Name, Control Source, and section. Put a summary text box in the Form Header or Form Footer rather than the Detail section, which may have no visible row when the form is empty.
Update an unbound record-count text box on Current and after Requery
Use this approach when the text box must reliably show 0 for an empty recordset and update after an external search dialog requeries the form.
Open the continuous form in Design View. Enable the Form Header/Footer sections if needed, place a text box in one of those sections, and set its Name to txtRecordCount. Leave its Control Source blank.
Open the form's VBA module and add this procedure: Public Sub UpdateRecordCount() Dim rs As DAO.Recordset Set rs = Me.RecordsetClone If rs.BOF And rs.EOF Then Me!txtRecordCount = 0 Else rs.MoveLast Me!txtRecordCount = rs.RecordCount End If rs.Close Set rs = Nothing End Sub This counts the records in the form's current recordset without changing the selected record on the form.
In the form's Property Sheet, open the Event tab, set On Current to [Event Procedure], and click the ellipsis button. Add UpdateRecordCount to the existing Form_Current procedure: Private Sub Form_Current() UpdateRecordCount End Sub
In the search dialog's button-click procedure, call the update immediately after requerying the continuous form: Forms("frmResults").Requery Forms("frmResults").UpdateRecordCount Replace frmResults with the actual name of your open continuous form. Apply any filter or query criteria before these calls.

Use a Count expression for a simple form total
Use an aggregate expression when you only need a record count and prefer a calculated control instead of VBA.
Use WPS Spreadsheets for exported Access results and reports
WPS Office is a free, lightweight alternative for working with Access results exported to Excel. Its familiar spreadsheet interface and Microsoft Office format compatibility make moving exported tables into spreadsheet reports straightforward. It does not run Access forms, VBA form events, or Access database files.

Frequently Asked Questions
Why does the text box disappear when my continuous form has no records?
A control in the Detail section appears within a record row. If the form has no records and does not display a new-record row, there is no Detail row to show it. In Design View, move the summary text box to the Form Header or Form Footer.
Where should I put the code if a search dialog requeries an already-open form?
Add the update call immediately after the search dialog's Forms("frmResults").Requery statement. Keep the same update call in the continuous form's On Current event so both normal navigation and externally triggered requeries are covered.
Will setting Default Value to 0 fix a calculated text box?
Not reliably. Default Value does not act as a fallback for a calculated Control Source. For explicit control over empty results, leave Control Source blank and assign 0 in VBA after checking the form's RecordsetClone.
Should I use Refresh, Requery, or Recalc after changing search criteria?
Use Requery when criteria changes require the form to retrieve a new set of records. Use Recalc afterward to reevaluate calculated controls, or call your unbound-control update procedure. Refresh alone does not rerun the form's underlying query to retrieve a new result set.
Can enabling Navigation Buttons make my custom text box show 0?
You can enable the built-in navigation area through Design View > Property Sheet > Format > Navigation Buttons > Yes. However, this does not populate a custom text box or make a Detail-section control visible without a row. Use a header or footer count control for the custom display.




