• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 953
  • Last Modified:

Access 2007 graph - program axes scale

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
merdeka
Asked:
merdeka
  • 4
  • 3
3 Solutions
 
Jeffrey CoachmanMIS LiasonCommented:
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
 
Jeffrey CoachmanMIS LiasonCommented:
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
 
merdekaAuthor Commented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
merdekaAuthor Commented:
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
 
Jeffrey CoachmanMIS LiasonCommented:
<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
 
Jeffrey CoachmanMIS LiasonCommented:
The bottom line is that in the source query you can format the field to display the Full month name.

;-)

JeffCoachman
0
 
merdekaAuthor Commented:
OK, thanks.

merdeka
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now