Others

Open an Access Form by Double-Clicking a Datasheet Row

John WilsonJohn Wilson Nov 18, 2026 868 views

Question details

Open a related Access form for a record when a user double-clicks a row in a datasheet.

Open an Access Form by Double-Clicking a Datasheet Row
Product
Microsoft Access
Device & OS
not provided
Scenario
A user wants to open a record's detail form by double-clicking a field in a datasheet row, without writing separate logic for every field.
Observed behavior
The form's double-click event may respond to the row selector but not to individual cells.
Before you start

Identify the primary key field, the name of the detail form, and whether users need to edit records directly in the datasheet. The examples below use a numeric key named RecordID and a detail form named frmDetails; replace these names with your own.

Solution 1Recommended

Use a list box when datasheet editing is not required

Use a list box to display records and open the selected record without assigning a double-click event to every field.

1
Add a list box

Open the containing form in Design View and add a list box named lstRecords. Set its Row Source to a query that returns RecordID as the first column, followed by the fields users should see.

2
Configure the columns

In the list box Property Sheet, set Column Count to match the query. If the ID should be hidden, set Column Widths so the first column is 0, and give the remaining columns visible widths.

3
Add the double-click event

On the list box's Event tab, set On Dbl Click to Event Procedure and select the builder button. In the VBA editor, add this code inside the generated procedure: If Not IsNull(Me!lstRecords.Column(0)) Then DoCmd.OpenForm "frmDetails", , , "[RecordID]=" & CLng(Me!lstRecords.Column(0)).

4
Test the selection

Open the containing form in Form View and double-click a displayed row. Confirm that frmDetails opens with the selected record.

Use a list box when datasheet editing is not required
Numeric key example: Column(0) refers to the first list box column. The example assumes RecordID is numeric; a text key requires a correctly quoted and escaped filter.
Free Microsoft Office alternative

Review exported Access data in WPS Spreadsheets

WPS Office is a free, lightweight alternative for working with exported data in a familiar spreadsheet interface. Export an Access query or table to an Excel file and open it in WPS Spreadsheets. WPS does not replace Access forms, VBA, or database functionality.

Review and organize exported Access records in a spreadsheet.Open and edit Microsoft Excel XLSX files for easier migration.Use a familiar tabbed interface for common spreadsheet tasks.Work with a free, lightweight office suite.
microsoft office alternative - wps office

Frequently Asked Questions

Why doesn't the form's double-click event fire for every datasheet cell?

A double-click on a cell can be handled by the control in that cell rather than by the form's event. Set the control's On Dbl Click property on the Event tab, or use a list box if direct editing is unnecessary.

Can I hide the record ID in the list box?

Yes. Include the ID as the first column in the list box Row Source, then set its first Column Widths value to 0 in the Property Sheet. The ID remains available through Column(0).

How do I open only the selected record in the detail form?

Pass a filter as the WhereCondition argument of DoCmd.OpenForm. For a numeric key, an example is "[RecordID]=" & recordID. Use the actual key field and form names from your database.

Do I still need to set an event on every editable field?

For the shared-function approach, set the same On Dbl Click expression on each control that should respond. The opening logic itself remains in one function, so you do not need a separate procedure for each control.