?
Solved

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

Posted on 2014-09-05
5
Medium Priority
?
232 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 9

Accepted Solution

by:
macarrillo1 earned 2000 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

801 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