I have 2 forms. The first one has a groupbox where the user selects their username, and an option box where they choose either group1, group2, or group3.
The second form has a variety of fields that I want the user to fill out. These fields are in groups. Group1 may have 10 fields, Group2 has 5, and Group3 has 12.
Now, what I want is this: When the user selects Group1 from the first form, I want the fields in Group2 and Group3 to be greyed out. I don't want the user to be abe to update any of them. If they choose Group2, groups 1 & 2 will be greyed out, etc.
Since Acces doesn't let you create control arrays (directly) like VB does, you have to either do it manually, or get a little creative.
A neat little trick is to use the Tag property. Put a 1 in the Tag for all group 1 controls, ditto for groups 2 and 3.
Using code similar to the following, you can enable and disable the desired controls. This code I snabbed from my current project where the user complets the form in stages, so groups of controls get enabled at a time (similar to what you're asking for):
Public Sub MoveFocus(EnableControl As String, DisableControl As String, FormName As String, WithLock As Boolean)
Dim ctl As Control
Dim frm As Form
Set frm = Forms(FormName)
On Error Resume Next
For Each ctl In frm.Controls
If WithLock Then
If ctl.Tag = EnableControl Then ctl.Locked = True
If ctl.Tag = DisableControl Then ctl.Locked = False
If ctl.Tag = EnableControl Then ctl.Enabled = True
If ctl.Tag = DisableControl Then ctl.Enabled = False
If Err Then Err.Clear
Set ctl = Nothing
Set frm = Nothing
Have fun. As always, there are various ways - somebody will likely post a better way