ka******@comcast.net via AccessMonster.com wrote:
hey all.. is there a better way to do this:
If IsNull(Forms!formquerybuilder.Controls!cboxupsourc e) = False Then
Me!Text342.Visible = False
Me!Text352.Visible = False
Me!Label343.Visible = False
Me!Text205.Visible = False
Me!Text206.Visible = False
Me!txtboxsoldunits.Visible = False
Me!Text208.Visible = False
Me!Text355.Visible = False
Me!Label356.Visible = False
Me!Text357.Visible = False
Me!Label358.Visible = False
Me!Text371.Visible = False
Me!Text375.Visible = False
Me!Text378.Visible = False
End If
my way seems kinda long and i have a lot of it in different places.
thanks.
Long ago I wrote myself a handful of custom functions...
LockAll(FormName, tagString)
UnLockAll(FormName, tagString)
DisableAll(FormName, tagString)
EnableAll(FormName, tagString)
ShowAll(FormName, tagString)
HideAll(FormName, tagString)
They all work the same way. I enter into the Tag property of all of the
controls I want to manipulate a common string. The functions cycle through all
controls on the form testing to see if the supplied tagString is within the Tag
property of the control. If it is then the appropriate property is set for that
control.
In your case I could enter "Hide" as the tag property of all of those controls.
Then I would just use...
If IsNull(Forms!formquerybuilder.Controls!cboxupsourc e) = False Then
HideAll(Me.Name, "Hide")
Else
ShowAll(Me.Name, "Hide")
End If
Here is an example of the HideAll function...
Function HideAll(FormName as String, TagString as String)
Dim frm as Form
Dim cnt as Control
Set frm = Forms(FormName)
For Each cnt in frm
If cnt.Tag Like "*" & TagString & "*" Then
cnt.Visible = False
End If
Next cnt
End Function
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com