many textbox selections

M

Maarkr

I have like 30 text boxes, each with a different name, with the following
control source (sounds like bad design, but its more of an app than a db):
=IIf(Not IsNull([estringfret]),[estringfinger],"")

I want a function or a way to address all 30 textboxes like the following:
If Me.TextE2 = "" Then
Me.TextE2.Visible = False
End If

How can I best address all text boxes to set the property to invisible if
the value is ="" ?

it's a program to build guitar chords by listing a chord and filling in the
fret and finger used for each string of the chord. the text boxes sit in
front of a tab diagram and shows the finger that goes on the string/fret, or
is invisible if no fret/finger info is in the db for that chord. thx
 
D

Douglas J. Steele

Assuming that the names of all text boxes you want to control like that
start Text and that no other text boxes on the form have names that start
with Text, you can use:

Dim ctlCurr As Control

For Each ctlCurr In Me!Controls
If Left(ctlCurr.Name, 4) = "Text" Then
ctlCurr.Visible = (Len(ctlCurr.Value) > 0)
End If
Next ctlCurr
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top