Search code examples
ms-accesssubform

Check only one checkbox in a subform


I have what I believe to be a common question about using a subform in datasheet view in access. My subform has a checkbox on it which performs some logic but checking any checkbox checks that checkbox for all the records. From what I see this behaviour can be altered by linking the checkbox to a datasource. However in my case the subform is based on a non-updatable query so binding to any member of the dataset results in the checkbox being uncheckable.

I am imagining some dastardly temporary table workarounds for this problem but they all feel like horrific hacks. Is there some way around this which won't make me feel too dirty?


Solution

  • So all the data controls, except that one check box, are bound to read-only query fields. And the check box is not bound to anything.

    You could base your form on a disconnected ADO recordset. See this article at Database Journal: Create In-Memory ADO Recordsets

    That technique seems less dirty to me than using a temporary table to accommodate the check box. Although you didn't tell us anything about the purpose of the check box, I'll hazard a guess this could work for your application.