Is it possible to make some fields invisible in a form based on the "NAME" of the field...
I have more than 40 fields in a single form. For different process,
I will have to display certain fields for data entry.
If you name the controls consistently the same text plus a number,
i.e. Text1, Text2, ...Text 40, etc., you can cycle through all the
controls using code. I'll assume you only want to affect text boxes.
Example only showing 2 controls.:
Dim T as TextBox
Dim intCount as integer
for intCount = 1 to 40
Set T = Me("Text" & intCount)
If T.Name = "Text5" or T.Name = "Text28" Then
T.Visible = False
Else
T.Visible = True
End If
Next intCount
===========
For only a few controls, you can name them directly:
[ControlA].Visible = [SomeField] = 3
[ControlB].Vislble = [SomeField] = 5
[ControlC].Visible = Not [SomeField] = 3
etc.