Making Some Fields Read-only in Query (1 Viewer)

Ghaznavi

Registered User.
Local time
Today, 08:19
Joined
Jun 20, 2010
Messages
23
Hi,

I have made a query to select multiple records (of a Yes/No type field in the table). All other fields of the query must be read only except this check box field. An easy solution given is to create a form (in Datasheet view) based on the query and choose NO for Enabled in property box. The problem is, that in this case, I am unable to filter the records (I need two fields to be filtered at least in order to select records and then click the check box in some of them). Kindly advise.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 05:19
Joined
Feb 19, 2013
Messages
16,607
you cannot do this in a query. You need to use a form as you have discovered - but try setting the locked property rather than the enabled property
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 00:19
Joined
May 21, 2018
Messages
8,527
You simply need to make a calculated field. You can keep it as a checkbox, but this will require setting a property in the query def. If you are OK with a "TRUE", "FALSE":
Code:
SELECT
 ID,
 IIf([blnField],"TRUE","FALSE") AS NotEditableYesNo
FROM tblDetail;
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 00:19
Joined
May 21, 2018
Messages
8,527
If you need to make your calculated field a checkbox the code is
CurrentDb.queryDefs("QueryName").Fields("FieldName").Properties("DisplayControl") = acCheckBox
 

Users who are viewing this thread

Top Bottom