Graph y-axis scaling manual scale in report

Rhabdo

Registered User.
Local time
Today, 15:44
Joined
Jun 4, 2014
Messages
28
Hi,

I have set up a form on which there is a graph which draws data from a query. I have set up a text boxes to take in the Y axis min, max and interval values so the user can customize the graph according tot he range coming out of the query. This all works fine and is perfect, however, i also need a report and set up a report with the same graph which can be printed to pdf, however, i cant get the y-axis to adjust like i do with the one on the form,

any ideas or suggestions?
 
Which code do you have in the report and under which report event is it placed?
To get some of the report's event to fire you need to chose the "Print Preview".
 
I have the same graphs in the report as are in the form, use the scaling text boxes to modify the form graphs and use control buttons to run the code for each graph.

I have tried putting the same code using the form text boxes as the sources into the 'on open' event for the report but this does not seem to work.

Not sure where else to put the code to get the report graphs to update to look like they are on the form.

Hope that makes sense?
 
..
I have tried putting the same code using the form text boxes as the sources into the 'on open' event for the report but this does not seem to work.
..
Do you get any error message, (then show it)?
The event "On Load" gets fired after the "On Open" event.
Else post your database with some sample data + info which form and report you use.
 
This is the code from the Form which i use to update the y-axis scale and parameters as required based on the output of the query on which the graph is based.

If Not Me![YminORP] = Empty Then Me![g_ORP].Axes(2).minimumscale = Me![YminORP]
If Not Me![YmaxORP] = Empty Then Me![g_ORP].Axes(2).maximumscale = Me![YmaxORP]
If Not Me![GapORP] = Empty Then Me![g_ORP].Axes(2).majorunit = Me![GapORP]
Me![g_ORP].Requery

I have the same graphs in a Report but they do not update the y-axis scale as the ones on the form do.

Can i put code into the 'on load' or 'on open' events to try get the graph in the report to update the y-axis scale based on the parameters set in the form?

If so can someone help me with the code/syntax, i have tried to reference the text boxes on the form directly (e.g. [Form1]![YmaxORP] but this comes up with an error, cannot find the object.

Thanks
 
Put the below code in the report Load event, (the form need to be open and you need to choose "Print Preview" when you open the report.
Code:
Me![g_ORP].Axes(2).MinimumScale = [Forms]![Form1]![YminORP]
Me![g_ORP].Axes(2).MaximumScale = [Forms]![Form1]![YmaxORP]
Me![g_ORP].Axes(2).MajorUnit = [Forms]![Form1]![GapORP]
 
It is giving me a run-time error '438'
object doesn't support this property or method
 
Because you are not choosing the "Print Preview" when you open the report as I wrote was necessary.
 
Thanks, sorry i changed the code to open the report directly into print preview and the min max values update fine. Awesome

I am just having trouble with the interval, it gives me a run-time error 1004
Unable to set the MajorUnit Property of the axis class.

Any ideas?works fine on the form.
 
Do you have the form open in "Form View" with value in the [YminORP], [YmaxORP] and [GapORP], (if you put value in the [GapORP] as last, you need to move focus to another control!)?
 
Yes the form is open, sorry i see now it only happens when the txt box for ygap is empty; should i put an if not = empty in?
 
Ok changed the code to:

If Not [Forms]![fr_insitu_SurfaceWater]![GapORP] = Empty Then Me![g_ORP].Axes(2).MajorUnit = [Forms]![fr_insitu_SurfaceWater]![GapORP]

and it seems to be working fine now.

Thanks for all the help :)
 

Users who are viewing this thread

Back
Top Bottom