Solved

Using Access 2010, how do I create a label that is based on this year?

Posted on 2014-09-05
5
227 Views
Last Modified: 2014-09-05
Hi,

I am trying to create report column labels based on the current year.
 1st label is current year - 3 years = 2011
  2nd label is current year - 2 years = 2012
  3rd label is current year - 1 year = 2013
  4th label is current year = 2014

Please keep in mind that I am a novice creating things in Access--I'll need specific directions on not only how to do it but where to put the formulas.  Thanks you very much!!

Pat
0
Comment
Question by:FFNStaff
  • 3
  • 2
5 Comments
 
LVL 9

Accepted Solution

by:
macarrillo1 earned 500 total points
ID: 40306174
Labels are meant to be static.

You could try putting a formula in the Report Properties On Load event similar to the following:

=[DateColumn1_Label].[Caption]=CStr(Year(Now())-1)

Or the Page Header Event Properties on the On Format or On Paint Events.

Start by bringing up your report in Design view and looking at the Event Tab of the Report.
0
 
LVL 9

Expert Comment

by:macarrillo1
ID: 40306202
Actually, looking at your problem again.

You can replace the label headings with Text Boxes and change the 'control source' (under Data tab) to something like

=Year(Now())-1

Then change the appearance of the text box so that it does not look like data entry. Under 'format' tab change 'Back Style' and 'Border Style' to 'Transparent'.
0
 

Author Comment

by:FFNStaff
ID: 40306232
Your comment about labels being static made sense so I changed the format and used the date part of the formula -- and it worked!!  Thank you.
0
 
LVL 9

Expert Comment

by:macarrillo1
ID: 40306267
Formulas would be:

=Year(Now())-3  1st label is current year - 3 years = 2011
=Year(Now())-2  2nd label is current year - 2 years = 2012
=Year(Now())-1  3rd label is current year - 1 year = 2013
=Year(Now())     4th label is current year = 2014

Instead of adding text boxes and deleting labels.  You can convert the existing labels. Right Click the old label and select 'Change to' and click 'Text Box'
0
 

Author Comment

by:FFNStaff
ID: 40306290
Thank you, macarrillo.  Your suggestions worked perfectly!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Outlook Free & Paid Tools
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now