First you should normalise your data - you should have a table with fields something like
tblCleanliness
CleanlinessPK text (e.g."C1") primary key
AreaDesc text (e.g."Floors")
then another
tblQuestions
QuestionPK autonumber
BuildingFK long
CleanlinessFK text (Child of CleanlinessPK in tblCleanliness
CheckOK Boolean (default false)
Comments text
I've assume something to link this back to the building, business, whatever as BuildingFK
then you would only need the one bit of code
The only other way you can do this that I can think of is to create a public function in a module
Code:
Public Function Cleanliness_AfterUpdate()
If screen.activecontrol= -1 Then 'If checkbox is checked
screen.activeform.subformname.form.controls(replace(screen.activecontrol,"A","C"))= screen.activeform.subformname.form.controls(replace(screen.activecontrol,"A","C")).DefaultValue
screen.activeform.subformname.form.controls(replace(screen.activecontrol,"A","C")).Enabled = True
Else
screen.activeform.subformname.form.controls(replace(screen.activecontrol,"A","C")) = ""
screen.activeform.subformname.form.controls(replace(screen.activecontrol,"A","C")).Enabled = False
End If
End Sub
change the subformname to the name of your subform control
then in your A1, A2 controls etc on afterupdate property put =Cleanliness_AfterUpdate() (i.e. i.e. replace the [Event Procedure]). You can do this by highlighting all the 'A' controls before typing this in.