Is there a wildcard character that VB recognizes?

jguscs

Registered User.
Local time
Today, 06:47
Joined
Jun 23, 2003
Messages
148
I'd like to perform the following code:
Me!Del1.Visible = False
Me!Del2.Visible = False
Me!Del10.Visible = False
Me!DelA.Visible = False
Me!Del.Visible = False

with the following code "concept":
Me!Del*.Visible = False

Currenlty, VB notes this code as a syntax error.
Is there some other way to do this?
 
Something along the lines of

Code:
Dim ctl As Control

For Each ctl In Me
   If Left(ctl.Name, 3) = "Del"
      ctl.Visible = False
   End If
Next
 
Put code like this somewhere in your form, perhaps in the click event of a command button:

Dim ctl As Control

 For Each ctl In Me.Controls
  If Left(ctl.Name, 3) = "Del" Then
   ctl.Visible = False
  End If
 Next ctl
 
Haha. Mile-O-Phile and I are on the same wavelength!
 
lol, I just missed out the Me.Controls part :rolleyes:
 

Users who are viewing this thread

Back
Top Bottom