VBA & Macro Problems

Add Temporary Record Selection Check Boxes to an Access Form

Emma BrownEmma Brown Nov 14, 2026 869 views

Question details

Select individual records temporarily on a continuous Access form without adding a selection field to the main table.

Add Temporary Record Selection Check Boxes to an Access Form
Product
Microsoft Access
Device & OS
not provided
Scenario
A user needs to mark several records independently in a continuous form.
Observed behavior
An unbound check box displays the same value across records instead of maintaining a separate selection for each one.
Before you start

Identify the form control that contains the record's primary key and confirm its data type. The example below assumes a numeric primary key and a control named PKcontrol.

Solution 1Recommended

Track selections in a local table and display them in a calculated check box

Use this approach to select records independently without changing the main table or adding the selection table to the form's record source.

The local table stores selected record IDs. A calculated check box displays whether each record is in that table, while a button adds or removes the current record.

For separate user selections, give each user a separate local front-end database containing their own selection table. The table's contents persist until they are cleared.

1
Create the selection table

In Access, select Create > Table Design. Create tblSelections with a RecordID field matching the numeric primary key's data type, and make RecordID the primary key to prevent duplicates. Save the table locally rather than adding it to the form's record source.

2
Add the display check box

Open the continuous form in Design View and add a check box in the detail section. In its Property Sheet, set Control Source to =Not IsNull(DLookUp("RecordID","tblSelections","RecordID=" & [PKcontrol])). Set Locked to Yes so the button controls selection.

3
Add a toggle button

Add a button to the detail section and set its On Click property to [Event Procedure]. Open the code editor with the build button and add this code inside the button's Click procedure: If Me.NewRecord Or IsNull(Me.PKcontrol) Then Exit Sub Dim id As Long id = Me.PKcontrol If DCount("*", "tblSelections", "RecordID=" & id) = 0 Then CurrentDb.Execute "INSERT INTO tblSelections (RecordID) VALUES (" & id & ")", dbFailOnError Else CurrentDb.Execute "DELETE FROM tblSelections WHERE RecordID=" & id, dbFailOnError End If Me.Recalc

4
Test and clear selections

Open the form in Form View and click the button on different records; each calculated check box should reflect its own selection. When the selection session is finished, open tblSelections and delete its rows, or run DELETE FROM tblSelections as an action query.

Adapt the key reference: Replace PKcontrol with your primary-key control name. The sample uses a Long numeric key; text or other key types require different VBA and SQL criteria.
Free Microsoft Office alternative

Work with Office Documents in WPS Office

WPS Office is a free, lightweight alternative for everyday documents, spreadsheets, and presentations. Its familiar interface and Office format support make it easy to move existing files into your workflow. It does not replace Microsoft Access or run this Access form solution.

Use spreadsheets to review tabular data alongside your Access workflowOpen and edit Microsoft Office formats including DOCX, XLSX, and PPTXNavigate documents with a familiar, easy-to-use interfaceUse a free, lightweight office suite for everyday work
microsoft office alternative - wps office

Frequently Asked Questions

Why does an unbound check box show the same value on every row?

In a continuous form, an unbound control has one value shared by its displayed instances. Store each selected record's key separately and use a calculated control to display its selection state.

Will the selections disappear when I close the form?

No. Records in tblSelections remain until you delete them. Run DELETE FROM tblSelections as an action query when you want to clear the list.

How can multiple users keep their selections separate?

Place tblSelections in each user's own local front-end database. A shared selection table without a user identifier would mix users' selections.

Can I use this code with a text primary key?

The example assumes a numeric key. For a text key, change the VBA variable type and build properly quoted SQL and DLookup criteria, including escaping any apostrophes in the key.