Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Access 2007 graph - program axes scale

Posted on 2010-09-23
7
Medium Priority
?
951 Views
Last Modified: 2012-05-10
I have an Access report that has a bar chart object on it.  I would like to programatically change the horizontal axis based on some date values from a table.  Also the horizontal axis is numeric rather than time value - can this be changed to time value programatically so it can display full months?

Here is the code that doesn't work:

Private Sub Report_Open(Cancel As Integer)
Dim graphObj As Object

Set graphObj = Me!Graph0
 graphObj.Axes(2).MinimumScale = 10000
 
End Sub]

The error message is:

Runtime error '438'
Object doesn't support this property or method

If I put this code in the graph object On_click event the axis scale changes but I don't want to have to click the graph to make it work properly especially since the report has 4 overlapping graphs.

End Sub

Thanks,
merdeka
0
Comment
Question by:merdeka
[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
  • 4
  • 3
7 Comments
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 2000 total points
ID: 33748213
You can't do this on the Report Open Event.

You must do this on the Format event of the Section that the chart resides in

For example, if the chart is in the Details section use this:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim graphObj As Object

Set graphObj = Me!Graph0
    graphObj.Axes(2).MinimumScale = 10000
 
End Sub


JeffCoachman
0
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 2000 total points
ID: 33748367
Also note that in Access 2007, "most" code will only fire in Print Preview (not in Report View)

<Also the horizontal axis is numeric rather than time value - can this be changed to time value programatically so it can display full months?>
Actually, this is an unrelated separate issue form your main post.
As you know, this site only allows one unique question per post.
But to address it somewhat...
This will depend on what format the source data is in.
If the source data is a date value, then the Chart wizard should have done this for you:
Jan '10, Feb '10, Mar '10, ...etc
But again, this should be addressed in a separate, new question.

;-)

JeffCoachman
0
 

Accepted Solution

by:
merdeka earned 0 total points
ID: 33748556
Jeff,

I don't mind asking another question.

It looks like your solution works and also I'm glad you add the comment on the result not appearing in Report View because that is what I was using for testing.

The scale does display dates but not full months.  Anyway I will submit another question (even though I am pretty sure I know the answer :-)

merdeka  
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:merdeka
ID: 33748618
Jeff,

I awarded you the points but at the bottom it asks for my reason for awarding myself the points - I'm not sure where that came from or what it means.

merdeka
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 33748770
<at the bottom it asks for my reason for awarding myself the points>
There seem to be some issues with closing question...
It should be fixed shortly...
;-)

Jeff
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 33748783
The bottom line is that in the source query you can format the field to display the Full month name.

;-)

JeffCoachman
0
 

Author Comment

by:merdeka
ID: 33748851
OK, thanks.

merdeka
0

Featured Post

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
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…

722 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