Clearing the captions of labels

  • Thread starter Thread starter Evan McCutchen
  • Start date Start date
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
 
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
 
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
 
Back
Top