Clearing the captions of labels

E

Evan McCutchen

Hello,

When a viewing form has reached the end of a set of records (ie, the form
displays "(Autonumber)" in the numbering field, how can i clear the captions
of labels on the form?

Any help would be greatly appreciated!

Thanks,
E.A. McCutchen
evan AT radiologyonesource DOT com
 
F

fredg

Hello,

When a viewing form has reached the end of a set of records (ie, the form
displays "(Autonumber)" in the numbering field, how can i clear the captions
of labels on the form?

Any help would be greatly appreciated!

Thanks,
E.A. McCutchen
evan AT radiologyonesource DOT com

Well, this is what you asked for.
The only problem you are going to run into is that once you clear the
captions, there gone (in this Form session only) unless you have some
way to put them back if you want them again. It's not a big deal to
do, but you need to be aware of it. The next time you open the form,
the labels are back anyway.

Code the Form's Current event:
If Me.NewRecord = True Then
Dim c As Control
'just clear the detail section unless you want everything, then use
For each c in Controls instead
For Each c In Me.Section(0).Controls
If TypeOf c Is Label Then
c.Caption = ""
End If
Next c
End If
 
E

Evan McCutchen

thanks!
fredg said:
Well, this is what you asked for.
The only problem you are going to run into is that once you clear the
captions, there gone (in this Form session only) unless you have some
way to put them back if you want them again. It's not a big deal to
do, but you need to be aware of it. The next time you open the form,
the labels are back anyway.

Code the Form's Current event:
If Me.NewRecord = True Then
Dim c As Control
'just clear the detail section unless you want everything, then use
For each c in Controls instead
For Each c In Me.Section(0).Controls
If TypeOf c Is Label Then
c.Caption = ""
End If
Next c
End If
 

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