Unable to dynamically set unassociated label's caption

E

emailchrisco

I must be doing something wrong and I'm sure it must be simple but I
can't get it to work.
Using the Report_Open section, I'm trying to set the text of an
unassociated label depending on the current month, like this:
Me.LblThisMonth.Caption = Month(date())
but when I do this and print preview it, the label shows no text, then
if I remove this line, then the text that is in the box on the design
view shows on the print preview. I've tried deleting the text from the
label in design view but then the label itself is deleted from the
report all together, so it seems I have to leave some text in it for it
to stay on the report.
Can someone let me know what I'm doing wrong?
Thanks.
 
D

Duane Hookom

If you want to change the property of a control, try do it in the On Format
event of the section of the report containing the control.
 
A

Allen Browne

Why not just use a text box with these properties:
Control Source =Date()
Format m
 
E

emailchrisco

Thanks Duane, that was it. I was thinking that since the code for my
controlsource statements for the text boxes in the report's header was
all in the Report_Open section that I would set the captions for the
labels in that section also. Nope. You set me straight.
Thanks again.
 

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