Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to automate graph axis dates?

Status
Not open for further replies.

brt79

Technical User
Mar 30, 2005
6
US
This is for a database that I have come into possesion of at work and now have responsibility of maintaining. Currently the data is entered and this data is added onto multiple graphs (in reports) that have the x-axis set to display the entire year (currently 2007). So as the year progresses, the graph lines progress until the end of the year is reached.

I now realize that coming up on 2008, I will need to manually go onto each graph and change the min and max parameters to 1/1/08 and 12/31/08 respectively. Apparently this is how it has been done in previous years. Not the hardest thing to change, but with in excess of 40 graphs, it will be slightly time consuming. I was wondering if there was some way to set the axis dates to automatically change each year to avoid having to manually change it year after year.

My only thought is to create a query to create dummy records for each day of the year and set this query to run for the current year. Then make a query to combine the real data and the dummy data grouped so I only have one entry for each day. Then I could put the graph axis min and max on auto. I'm not sure if this is the correct approach; it seems like there would be an easier way.

Thanks in advance for any help.
 
Go into object browser and look at the graph library. I use the following to set minimum scale on the y-axis:
Code:
Me![gphBlockK].Axes(2).MinimumScale = lngMinScale

There are methods & properties there that will do what you need.


Money can't buy happiness -- but somehow it's more comfortable to cry in a Corvette than in a Yugo.
 




...and
Code:
lngMinScale = DateSerial(Year(Date),1,1)
lngMaxScale = DateSerial(Year(Date),12,31)


Skip,
[sub]
[glasses] When a diminutive clarvoyant had disappeared from detention, headlines read...
Small Medium at Large[tongue][/sub]
 
Thanks alot guys. This is exactly what I needed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top