Label counting

A

Aziz

Does anyone have any code that enables me to count the
number of labels on a form. I ultimately want to check
whether one of the labels caption property has the string
that I expect.
 
E

Eric

-----Original Message-----
Does anyone have any code that enables me to count the
number of labels on a form. I ultimately want to check
whether one of the labels caption property has the string
that I expect.
.

Try this,
-----------
Dim ctrl As Control
Dim iIndex As Integer

For Each ctrl In Me.Controls
If ctrl.ControlType = acLabel Then
iIndex = iIndex + 1
End If
Next ctrl
 

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