Change Message In Text Box Weekly

jereece

Registered User.
Local time
Today, 09:06
Joined
Dec 11, 2001
Messages
300
I have a report of work orders that are currently scheduled that have a safety concern. At the top of my report (in the report header), I would like to display one of our Safety Guiding Principles and have this change each week (on Monday or Sunday - either is fine). Is there a way I can have this text automatically change the text each week? Here is the list of our Safety Guiding Principles:

Everyone is responsible for Safety
We look out for each other
Safety will be planned into our work
All Injuries are preventable
Management is accountable for preventing injuries
Employees must be trained to work safely
Working safely is a condition of employment
Safety performance will be measured
All deficiencies must be resolved
React to incidents, not just injuries
Off-the-job safety is as important as on-the-job safety
It's good business to prevent injuries
We will comply with applicable occupational health and safety regulations


I appreciate any help.
Jim
 
I only tested this using the debug window, but it should work:

Code:
Private Sub Report_Open(Cancel As Integer)

Dim Captxt(12) As String '13 elements in array

Captxt(0) = "Everyone is responsible for Safety"
Captxt(1) = "We look out for each other"
Captxt(2) = "Safety will be planned into our work"
Captxt(3) = "All Injuries are preventable"
Captxt(4) = "Management is accountable for preventing injuries"
Captxt(5) = "Employees must be trained to work safely"
Captxt(6) = "Working safely is a condition of employment"
Captxt(7) = "Safety performance will be measured"
Captxt(8) = "All deficiencies must be resolved"
Captxt(9) = "React to incidents, not just injuries"
Captxt(10) = "Off-the-job safety is as important as on-the-job safety"
Captxt(11) = "It's good business to prevent injuries"
Captxt(12) = "We will comply with applicable occupational health and safety regulations" 

Me!MyHdrLabel.Caption = _
        Captxt(DateDiff("ww", DateValue("1/1/" & Year(Now)), Now) Mod 13)

End Sub

Lemme know how that goes for you...

Doug.

(edited array element text for consistancy...)
 
Last edited:
Doug,

Thanks for your quick reply, but please help me out just a little further. Where do I put this code. I have done this as an event procedure for a button, but I have never added code like this for a text box. So can you explain where or how I add this code?

I do appreciate your help. :)

Jim
 
The code goes in the On Open event of your report.

Open your report up in design view and look for the On Open event in the Properties list. Choose [Event Procedure] from the drop down list for the On Open property, then click on the (...). That'll open the code window for the Open event of the report.

I wouldn't use a text box on the report for this - just use a label in your report header. I don't think you need anything more than a label.

If your report already has code in the Open event, you'll have to work this code around the existing code.

hth,

Doug.
 
That seems to work. I really appreciate the extra explaination effort. That got me over the hump.

Thanks! :)
Jim
 

Users who are viewing this thread

Back
Top Bottom