I found a way to reference all the controls in a subform, by clicking in the subform without having to know the subform's control name.
Example: I wanted to lock all the controls in a subform when someone moved to a different record within that 'same' subform. Using the OnCurrent event of the subform, I put "UnlockAllControlsOnSubform()", then wrote the follwing Public function:
Function UnlockAllControlsOnSubform()
Dim frmForm As Form
Dim ctrl
Set frmForm = Screen.ActiveForm(Screen.ActiveForm.ActiveControl.Name).Form
For Each ctrl In frmForm.Controls
ctrl.Locked = False
Next
End Function
My main form has 6 subforms in it within a tab group, and I didn't want to write the same function 6 times. So I created one function to handle all of the subforms.
Note: Did not test with Access 2007.

































