By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,247 Members | 871 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,247 IT Pros & Developers. It's quick & easy.

Changing graph axis min max on report

P: n/a
Hi

I have a report with a graph on it and want to change the minimum and
maximum values for the value axis when it is previewed. This can't be done
by adding code in the Open event as once the report has started printing the
properties can't be changed.

It can be done with an MDB by opening it in design mode hidden, making the
change, saving it and then opening it in preview mode. However, this
obviously doesn't work in an MDE which is how this is distributed.

If I leave it on Auto the graph does not always set the minimum and maximum
to sensible values, and sometimes the 4 series are all bunched together and
unreadable.

Does any one have any ideas?

Jeff
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Jeff wrote:
Hi

I have a report with a graph on it and want to change the minimum and
maximum values for the value axis when it is previewed. This can't be
done by adding code in the Open event as once the report has started
printing the properties can't be changed.
Why not use a Form instead?
It can be done with an MDB by opening it in design mode hidden,
making the change, saving it and then opening it in preview mode.
However, this obviously doesn't work in an MDE which is how this is
distributed.

If I leave it on Auto the graph does not always set the minimum and
maximum to sensible values, and sometimes the 4 series are all
bunched together and unreadable.
Make sure all your settings are correct....
Does any one have any ideas?

Jeff


You can set the value in code on the OnFormat property I think. You
would need to reference the MSGraph object if you want to use the Graph
object in code.

I've done a lot with MSGraph via code so if you need more info I'll try
and dig up an example.

ps. Another suggestion: I store the graph object in a table and display
it on a report that way
--
regards,

Bradley
Nov 12 '05 #2

P: n/a
Well rip my knickers and kick my a... Putting the code in the On Format for
the report works, but it doesn't in the On Open. In On Open it says the
properties can't be changed once printing has started!!!! But it works in
the On Format??? I assumed On Format wouldn't work...shouldn't assume.

The values only need to be set once for the report, which is why I chose the
On Open event.

Thanks Bradley. That problem is solved.

Here is another. This same graph is on a form. On the form users enter a
couple of parameters and press a button to process data for the graph. Last
thing before requerying the graph it changes axis min and max values.

The problem is, open the form, enter params and press button to calc and
display query and min max don't change from last time the form was used.
Leave params as are and press button again, running same code again, and it
works, and continues to work there after. Close the form and reopen it and
same problem again.

When the form is opened, the first time doesn't change the setting. I have
stepped through code and it sets the values but the graph min max doesn't
change, other then displaying the data correctly.

Jeff

"Bradley" <br*****@REMOVETHIScomcen.com.au> wrote in message
news:_p******************@news-server.bigpond.net.au...
Jeff wrote:
Hi

I have a report with a graph on it and want to change the minimum and
maximum values for the value axis when it is previewed. This can't be
done by adding code in the Open event as once the report has started
printing the properties can't be changed.


Why not use a Form instead?
It can be done with an MDB by opening it in design mode hidden,
making the change, saving it and then opening it in preview mode.
However, this obviously doesn't work in an MDE which is how this is
distributed.

If I leave it on Auto the graph does not always set the minimum and
maximum to sensible values, and sometimes the 4 series are all
bunched together and unreadable.


Make sure all your settings are correct....
Does any one have any ideas?

Jeff


You can set the value in code on the OnFormat property I think. You
would need to reference the MSGraph object if you want to use the Graph
object in code.

I've done a lot with MSGraph via code so if you need more info I'll try
and dig up an example.

ps. Another suggestion: I store the graph object in a table and display
it on a report that way
--
regards,

Bradley

Nov 12 '05 #3

P: n/a
Jeff wrote:
Well rip my knickers and kick my a... Putting the code in the On
Format for the report works, but it doesn't in the On Open. In On
Open it says the properties can't be changed once printing has
started!!!! But it works in the On Format??? I assumed On Format
wouldn't work...shouldn't assume.
Good idea :) If you think about it it does make sense though.
The values only need to be set once for the report, which is why I
chose the On Open event.

Thanks Bradley. That problem is solved.
Great, that was simple enough:)
Here is another. This same graph is on a form. On the form users
enter a couple of parameters and press a button to process data for
the graph. Last thing before requerying the graph it changes axis min
and max values.

The problem is, open the form, enter params and press button to calc
and display query and min max don't change from last time the form
was used. Leave params as are and press button again, running same
code again, and it works, and continues to work there after. Close
the form and reopen it and same problem again.

When the form is opened, the first time doesn't change the setting. I
have stepped through code and it sets the values but the graph min
max doesn't change, other then displaying the data correctly.

Jeff
I'm just trying to think of some "tricks" I had to do when I was working
with Graph....

(1) Before changing any properties try moving the focus to the Graph
object (even try moving focus back afterwards?)

eg. Code that update the data behind my graph

Me.Refresh
ExtractChart Me![ChartID], False 'function that gets data
Me.Refresh
Me![MyGraph].SetFocus
SetDatasheet Me![MyGraph], Me![ChartID], True 'function that put
data on datasheet
Me![MyGraph].SetFocus 'seems to be needed to force chart to refresh

(2) Don't assign values from a form to a graph property directly, assign
to a variable first

(3) Another oddity, "MyGraph.Datasheet.Cells.ClearContents" doesn't work
properly in A97 but does in A2000 (it clears the contents but does not
reset the chart's range). In A97 I had to delete the cells in the
datasheet but that cleared all my series settings.

Hope that helps.

Bradley

"Bradley" <br*****@REMOVETHIScomcen.com.au> wrote in message
news:_p******************@news-server.bigpond.net.au...
Jeff wrote:
Hi

I have a report with a graph on it and want to change the minimum
and maximum values for the value axis when it is previewed. This
can't be done by adding code in the Open event as once the report
has started printing the properties can't be changed.


Why not use a Form instead?
It can be done with an MDB by opening it in design mode hidden,
making the change, saving it and then opening it in preview mode.
However, this obviously doesn't work in an MDE which is how this is
distributed.

If I leave it on Auto the graph does not always set the minimum and
maximum to sensible values, and sometimes the 4 series are all
bunched together and unreadable.


Make sure all your settings are correct....
Does any one have any ideas?

Jeff


You can set the value in code on the OnFormat property I think. You
would need to reference the MSGraph object if you want to use the
Graph object in code.

I've done a lot with MSGraph via code so if you need more info I'll
try and dig up an example.

ps. Another suggestion: I store the graph object in a table and
display it on a report that way
--
regards,

Bradley


--
regards,

Bradley
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.